1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-30 07:10:58 +02:00

40929 (replaces 40598): paramsubst() should always return scalar when PREFORK_SINGLE was passed in from prefork()

Previous commit (74fe4d09) consumed too much of the input linked list,
leading to later expansions being skipped.  This commit converts from
array to string sooner, but may thereby alter rc_expand_param and array
element uniqueness behavior.
This commit is contained in:
Barton E. Schaefer 2017-04-02 14:43:27 -07:00
parent eaeebeb8bb
commit 207263a61e
2 changed files with 13 additions and 13 deletions

View file

@ -1,3 +1,8 @@
2017-04-02 Barton E. Schaefer <schaefer@zsh.org>
* 40929 (replaces 40598): Src/subst.c: paramsubst() should always
return scalar when PREFORK_SINGLE was passed in from prefork()
2017-04-01 Barton E. Schaefer <schaefer@zsh.org>
* Sebastian: 40782: Completion/Unix/Type/_hosts: avoid dependency

View file

@ -446,7 +446,7 @@ singsub(char **s)
* NULL to use IFS). The return value is true iff the expansion resulted
* in an empty list.
*
* *ms_flags is set to bits in the enum above as neeed.
* *ms_flags is set to bits in the enum above as needed.
*/
/**/
@ -3779,6 +3779,13 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
* as a scalar.)
*/
if (isarr && ssub) {
/* prefork() wants a scalar, so join no matter what else */
val = sepjoin(aval, NULL, 1);
isarr = 0;
l->list.flags &= ~LF_ARRAY;
}
/*
* If a multsub result had whitespace at the start and we're
* splitting and there's a previous string, now's the time to do so.
@ -4026,18 +4033,6 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
y = dupstring(nulstring);
setdata(n, (void *) y);
}
if (isarr && ssub) {
/* prefork() wants a scalar, so join no matter what else */
LinkNode tn;
aval = hlinklist2array(l, 0);
val = sepjoin(aval, NULL, 1);
n = firstnode(l);
for (tn = lastnode(l); tn && tn != n; tn = lastnode(l))
uremnode(l, tn);
setdata(n, (void *) val);
l->list.flags &= ~LF_ARRAY;
}
if (eval)
*str = (char *) getdata(n);