Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: fix :W and :w duplicating input
- X-seq: zsh-workers 54691
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Cc: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- Subject: PATCH: fix :W and :w duplicating input
- Date: Sun, 7 Jun 2026 06:59:33 +0200
- Archived-at: <https://zsh.org/workers/54691>
- In-reply-to: <20221118122922.sp3jblwpa2xw5uji@chazelas.org>
- List-id: <zsh-workers.zsh.org>
- References: <20221118122922.sp3jblwpa2xw5uji@chazelas.org>
Reported in 50991 and introduced in 22525.
---
Src/subst.c | 2 +-
Test/D04parameter.ztst | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/Src/subst.c b/Src/subst.c
index f72a6baf27..1776d5e164 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(©);
@@ -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 21b1b9dcea..c09821c85e 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 $#; }
--
2.38.1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author