summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2018-11-21 10:10:03 +0000
committerPeter Stephenson <p.stephenson@samsung.com>2018-11-21 10:10:03 +0000
commit50f8fa972c3795a115e7faff0b4c140b40eab5f0 (patch)
treee179ad02a9e1d463634e04bf35a249d253a91a98
parent8d0f7681a05c4c49a22cb67b585f54e6f2e29931 (diff)
downloadzsh-50f8fa972c3795a115e7faff0b4c140b40eab5f0.tar.gz
zsh-50f8fa972c3795a115e7faff0b4c140b40eab5f0.tar.xz
zsh-50f8fa972c3795a115e7faff0b4c140b40eab5f0.zip
43837 plus test from Daniel: Empty string in nested subst.
Skip Nularg or there is a bogus character at the start.
-rw-r--r--ChangeLog6
-rw-r--r--Src/subst.c2
-rw-r--r--Test/D04parameter.ztst7
3 files changed, 15 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ced545aaf..69a94687c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-11-21  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 43837 (test from Daniel): Src/subst.c, Test/D04parameter.ztst:
+	Nested substitution didn't remove Nularg from empty string,
+	giving bogus character.
+
 2018-11-19  Jun-ichi Takimoto  <takimoto-j@kba.biglobe.ne.jp>
 
 	* 43829: Src/Modules/nearcolor.c: use double instead of float
diff --git a/Src/subst.c b/Src/subst.c
index c706b9688..ff6750a59 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2405,6 +2405,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
 	    aspar = 0;
 	} else if (aspar)
 	    idbeg = val;
+	if (*val == Nularg)
+	    ++val;
 	*s = sav;
 	/*
 	 * This tests for the second double quote in an expression
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index e327a784c..7ab2384aa 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -2430,3 +2430,10 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888
   )
 0:Use of parameter subst + to test element of hash with KSH_ARRAYS.
 >0
+
+ for baz in "" "inga"; do
+   echo ${#${baz}} "${#${baz}}" ${#baz} "${#baz}"
+ done
+0:double-quoted nested evaluation of empty string
+>0 0 0 0
+>4 4 4 4