about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--Src/subst.c10
-rw-r--r--Test/D04parameter.ztst9
3 files changed, 27 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a7eb45224..27335d8f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2015-07-06  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* unposted: Doc/Zsh/expn.yo: alphabetize ${(b)...} flag
+
+	* 35709: Doc/Zsh/expn.yo: explain :s/// modifier contexts
+
+	* 35694: Src/subst.c, Test/D04parameter.ztst: fix handling of
+	history modifiers (specifically :s/l/r/) when applied across all
+	elements of an array parameter value
+
 2015-07-06  Oliver Kiddle  <opk@zsh.org>
 
 	* 35704: Doc/Zsh/compwid.yo, Src/Zle/compcore.c, Src/Zle/complete.c;
diff --git a/Src/subst.c b/Src/subst.c
index 81d34d28a..021d23444 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -3834,8 +3834,14 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags)
 		y = dupstring(nulstring);
 	    insertlinknode(l, n, (void *) y), incnode(n);
 	}
-	if (eval)
-	    n = on;
+	/* This used to omit restoring of *str and instead test
+	 *   if (eval)
+	 *       n = on;
+	 * but that causes strange behavior of history modifiers when
+	 * applied across all values of an array.  What is magic about
+	 * eval here that *str seemed not to need restoring?
+	 */
+	*str = getdata(n = on);
     } else {
 	/*
 	 * Scalar value.  Handle last minute transformations
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index d06a73afd..0a9e2530c 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -1711,3 +1711,12 @@
 0:Avoid confusion after overloaded characters in braceless substitution in sh
 >13
 >0-1
+
+  a="aaa bab cac"
+  b=d
+  echo $a:gs/a/${b}/
+  a=(aaa bab cac)
+  echo $a:gs/a/${b}/
+0:History modifier works the same for scalar and array substitution
+>ddd bdb cdc
+>ddd bdb cdc