summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2026-06-07 06:53:33 +0200
committerMikael Magnusson <mikachu@gmail.com>2026-06-10 05:20:51 +0200
commit5bb0960729b86a360be153b35a2e7f92a2d8ade3 (patch)
treef8eebc911f4c4be7ff24350f8ea639477b718ad7
parent54688: handle Stéphane correctly (diff)
downloadzsh-5bb0960729b86a360be153b35a2e7f92a2d8ade3.tar
zsh-5bb0960729b86a360be153b35a2e7f92a2d8ade3.tar.gz
zsh-5bb0960729b86a360be153b35a2e7f92a2d8ade3.tar.bz2
zsh-5bb0960729b86a360be153b35a2e7f92a2d8ade3.tar.lz
zsh-5bb0960729b86a360be153b35a2e7f92a2d8ade3.tar.xz
zsh-5bb0960729b86a360be153b35a2e7f92a2d8ade3.tar.zst
zsh-5bb0960729b86a360be153b35a2e7f92a2d8ade3.zip
54691: fix :W and :w duplicating input
Reported in 50991 and introduced in 22525.
-rw-r--r--ChangeLog3
-rw-r--r--Src/subst.c2
-rw-r--r--Test/D04parameter.ztst8
3 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index beb6b1383..a23fbde14 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2026-06-10 Mikael Magnusson <mikachu@gmail.com>
+ * 54691: Src/subst.c, Test/D04parameter.ztst: fix :W and :w
+ duplicating input
+
* 54688: Src/pattern.c, Test/D07multibyte.ztst: handle Stéphane
correctly
diff --git a/Src/subst.c b/Src/subst.c
index f72a6baf2..1776d5e16 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -4737,7 +4737,6 @@ modify(char **str, char **ptr, int inbrace)
*e = '\0';
if (c != 'l' && c != 'u')
copy = dupstring(tt);
- *e = tc;
switch (c) {
case 'a':
chabspath(&copy);
@@ -4804,6 +4803,7 @@ modify(char **str, char **ptr, int inbrace)
copy = xsymlink(copy, 1);
break;
}
+ *e = tc;
tc = *tt;
*tt = '\0';
nl = al + strlen(t) + strlen(copy);
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 57de28c72..e44af8ad7 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -1911,6 +1911,14 @@
>
>
+ wu='aa bb cc'
+ echo $wu:wu
+ W=FOOBAR
+ echo $W:W_B_l
+0:repeated upper/lowercase modifiers
+>AA BB CC
+>fooBar
+
# This used to cause uncontrolled behaviour, but at best
# you got the wrong output so the check is worth it.
args() { print $#; }