summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--Src/utils.c4
-rw-r--r--Test/D04parameter.ztst5
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