summaryrefslogtreecommitdiffstats
path: root/Src
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2026-06-04 09:06:02 +0200
committerMikael Magnusson <mikachu@gmail.com>2026-06-10 05:20:50 +0200
commite5e9caa2ee2188444e06ea1e162eb23375ca7538 (patch)
treece0dbc6605b107f93277e56bf51940369372d2f1 /Src
parentunposted: NEWS: document COLUMNS+LINES change from w/54676 (diff)
downloadzsh-e5e9caa2ee2188444e06ea1e162eb23375ca7538.tar
zsh-e5e9caa2ee2188444e06ea1e162eb23375ca7538.tar.gz
zsh-e5e9caa2ee2188444e06ea1e162eb23375ca7538.tar.bz2
zsh-e5e9caa2ee2188444e06ea1e162eb23375ca7538.tar.lz
zsh-e5e9caa2ee2188444e06ea1e162eb23375ca7538.tar.xz
zsh-e5e9caa2ee2188444e06ea1e162eb23375ca7538.tar.zst
zsh-e5e9caa2ee2188444e06ea1e162eb23375ca7538.zip
54674: ::= didn't respect parameter flags
The documentation says ${name::=word} In the first form, if name is unset then set it to word; in the second form, if name is unset or null then set it to word; and in the third form, unconditionally set name to word. In all forms, the value of the parameter is then substituted. Particularly that "the value of the parameter is substituted", not "the word is substituted". This is what happens before the fix, and similarly for array flags like "unique": % typeset -E3 fl; hi=5; echo ${fl::=hi} hi % echo $fl 5.00e+00
Diffstat (limited to 'Src')
-rw-r--r--Src/subst.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/Src/subst.c b/Src/subst.c
index 16a3cb055..f72a6baf2 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -3300,13 +3300,23 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
Param pm = sethparam(idbeg, a);
if (pm)
aval = paramvalarr(pm->gsu.h->getfn(pm), hkeys|hvals);
- } else
- setaparam(idbeg, a);
+ } else {
+ Param pm = setaparam(idbeg, a);
+ if (pm)
+ aval = pm->gsu.a->getfn(pm);
+ }
isarr = 1;
arrasg = 0;
} else {
untokenize(val);
- setsparam(idbeg, ztrdup(val));
+ Param pm = setsparam(idbeg, ztrdup(val));
+ if (pm) {
+ struct value vbuf = { 0 };
+ vbuf.pm = pm;
+ vbuf.end = -1;
+ vbuf.valflags = VALFLAG_SUBST;
+ val = getstrvalue(&vbuf);
+ }
}
*idend = sav;
copied = 1;