diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | Src/utils.c | 2 | ||||
-rw-r--r-- | Test/D04parameter.ztst | 16 |
3 files changed, 23 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog index 2cefa9894..23713f54f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-05-01 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * users/17046: Src/utils.c, Test/D04parameter.ztst: don't + count too many elements when splitting quoted parameter + substitution on null separator. + 2012-05-01 Mikael Magnusson <mikachu@gmail.com> * 30456: Completion/Unix/Command/_getconf: Use new array syntax. @@ -16254,5 +16260,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5644 $ +* $Revision: 1.5645 $ ***************************************************** diff --git a/Src/utils.c b/Src/utils.c index fb65ba815..9603389cc 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -3114,7 +3114,7 @@ wordcount(char *s, char *sep, int mul) r = 1; sl = strlen(sep); for (; (c = findsep(&s, sep, 0)) >= 0; s += sl) - if ((c && *(s + sl)) || mul) + if ((c || mul) && (sl || *(s + sl))) r++; } else { char *t = s; diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index cdeb15bfd..01f841218 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -1292,7 +1292,7 @@ >in >it - foo="line:with::missing::fields:in:it" + foo="line:with::missing::fields:in:it:" print -l "${(@s.:.)foo}" 0:Retention of empty fields in quoted splitting with "@" >line @@ -1303,6 +1303,20 @@ >fields >in >it +> + + str=abcd + print -l ${(s..)str} + print -l "${(s..)str}" +0:splitting of strings into characters +>a +>b +>c +>d +>a +>b +>c +>d array=('%' '$' 'j' '*' '$foo') print ${array[(i)*]} "${array[(i)*]}" |