diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2011-08-17 19:00:08 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2011-08-17 19:00:08 +0000 |
commit | 815e52cdbf0a62bf795d5af8e7089aaca5709806 (patch) | |
tree | ecc5703b2ecc51cc2db7f29e71662a9549dbfda5 | |
parent | 5bbedb3df35aaa0cb72882674f50eb89f8d30a7b (diff) | |
download | zsh-815e52cdbf0a62bf795d5af8e7089aaca5709806.tar.gz zsh-815e52cdbf0a62bf795d5af8e7089aaca5709806.tar.xz zsh-815e52cdbf0a62bf795d5af8e7089aaca5709806.zip |
users/16253, users/16255: a nulstring should be split like an empty string
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Src/utils.c | 4 | ||||
-rw-r--r-- | Test/D04parameter.ztst | 5 |
3 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index bd9d9229b..76eb0d1dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2011-08-17 Peter Stephenson <p.w.stephenson@ntlworld.com> - * Anthony R Fletcher: users/16260: + * users/16253, users/16255: Src/utils.c, Test/D04parameter.ztst: + A nulstring should be split like an empty string. + + * Anthony R Fletcher: users/16260: Completion/Unix/Command/_systemctl: new completion. 2011-08-17 Nikolai Weibull <now@bitwi.se> @@ -15294,5 +15297,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5437 $ +* $Revision: 1.5438 $ ***************************************************** diff --git a/Src/utils.c b/Src/utils.c index 439b43aa9..c8d021c66 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -3176,6 +3176,10 @@ sepsplit(char *s, char *sep, int allownull, int heap) int n, sl; char *t, *tt, **r, **p; + /* Null string? Treat as empty string. */ + if (s[0] == Nularg && !s[1]) + s++; + if (!sep) return spacesplit(s, allownull, heap, 0); diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index 8f95420dd..71c79687f 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -1453,3 +1453,8 @@ print ${foo:5:-6} 1:Regression test for total length < 0 in array ?(eval):2: substring expression: 3 < 5 + + foo=(${(0)"$(print -n)"}) + print ${#foo} +0:Nularg removed from split empty string +>0 |