diff options
author | Barton E. Schaefer <schaefer@zsh.org> | 2015-07-06 12:02:36 -0700 |
---|---|---|
committer | Barton E. Schaefer <schaefer@zsh.org> | 2015-07-06 16:35:05 -0700 |
commit | a9add3de545d71be3d882f94714e4d2857b0ef15 (patch) | |
tree | 015fa8f5110e8d87f2cdf191213d53054dc7e2ce | |
parent | 68a5a5f453d9534748e12d268718a97b7e84c31b (diff) | |
download | zsh-a9add3de545d71be3d882f94714e4d2857b0ef15.tar.gz zsh-a9add3de545d71be3d882f94714e4d2857b0ef15.tar.xz zsh-a9add3de545d71be3d882f94714e4d2857b0ef15.zip |
35694: fix handling of history modifiers applied across all elements of an array parameter value
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | Src/subst.c | 10 | ||||
-rw-r--r-- | Test/D04parameter.ztst | 9 |
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 |