From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: $* assignment regression in shwordsplit
Date: Sun, 2 Apr 2017 13:15:02 -0700 [thread overview]
Message-ID: <170402131502.ZM9344@torch.brasslantern.com> (raw)
In-Reply-To: <20170402175851.GA10565@fujitsu.shahaf.local2>
Hrm. Well, we can do it this way instead, but that changes the effects
of ${(u)...} and and ${^...} in the expansion, requiring an extra level
of nested braces.
Obviously in the bit removed by this patch it's the wrong thing to join
up the entire input linklist. I guess we'd need to join only the nodes
added around the input node n (plus turn off LF_ARRAY), but there's no
good way to keep track of that (?). Maybe it would work to join up
everything to the left of n. Anybody with a clearer idea what's going
on here care to interject?
Meanwhile this fixes the bug without failing the other related tests.
diff --git a/Src/subst.c b/Src/subst.c
index e639c96..5b1bf89 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -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);
prev parent reply other threads:[~2017-04-02 20:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-02 17:45 Martijn Dekker
2017-04-02 17:49 ` Martijn Dekker
2017-04-02 17:58 ` Daniel Shahaf
2017-04-02 20:15 ` Bart Schaefer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=170402131502.ZM9344@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).