summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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