From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3995 invoked by alias); 2 Apr 2017 20:15:06 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 40929 Received: (qmail 21150 invoked from network); 2 Apr 2017 20:15:06 -0000 X-Qmail-Scanner-Diagnostics: from mail-vk0-f46.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.213.46):SA:0(0.5/5.0):. Processed in 1.137816 secs); 02 Apr 2017 20:15:06 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_SPAM,SPF_PASS, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.213.46 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=Y9Obg/45Hw6W/IUTPvVVkQrWPPivzRtBdJK3sqdU/ig=; b=JlpVC+/aUMvzM45ej9wlrsmKSrCcUQ8tgAT6w+1d9MDU89JX/SDc54SpLLGYXPTtGb S4LpR36RiUVfABqvtnQHXAnroYoPP/ogr0ZEknWQWuFpRjvp26sgkkGsvuA4cOyz1jZZ ohnMKoKBoqXuqqnPEONSsb6GfG09WQmpYwH4WLSXc13i2s8FVOnxVg9mDfzDeCM0Cz0d dCKJDt9v5d0h5ERWDUdphMJTpVeM9aVFziomQ2gjKH50kwpKFY77gfGm2rdu2dKrFlhV 3IwismD3szHLW9wQA/s1BfiZnMi6XjbL60Q4mxgMEc8Zk4ABK7eSM4u3IEICM5JCybR2 2Zxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=Y9Obg/45Hw6W/IUTPvVVkQrWPPivzRtBdJK3sqdU/ig=; b=WrC8pw1C6na34O7otKB8lcnBc6gALmyk4ttcILwH3DwznDXaTw7qNBTcGiVUyIQb2Z m9AKFC6KDzJjZElIRVQxutu2fJ5US//2aaCEx2N4U6VV3U2AiBrh1Ka6Caii8/RsKISK s814SVK08m9YbpDBNWhwlD9Hc95ZyMB7lzMb5dqpg516xK6oK7kLhxo5jpRofO7Enju5 IfU3BvUtPtXYgR3wUIJZ7XM71zsBiYtw9KqelxWASLRMsR8Wbu73LNSHn/msuS+NnC4i LE6irTgH/SgR0jTG5wjOdB8Q7EF4FEql9+YCTIsLhC5ETcRX53sielgXvZd8a2arOPT9 5hEg== X-Gm-Message-State: AFeK/H0hDT3YkUM5c9vpH3Ra252U2bmy6Em8shosibNB+ru1HzZ8Jh7jTJFisJgDJrGFqg== X-Received: by 10.31.92.69 with SMTP id q66mr5834951vkb.119.1491164099234; Sun, 02 Apr 2017 13:14:59 -0700 (PDT) From: Bart Schaefer Message-Id: <170402131502.ZM9344@torch.brasslantern.com> Date: Sun, 2 Apr 2017 13:15:02 -0700 In-Reply-To: <20170402175851.GA10565@fujitsu.shahaf.local2> Comments: In reply to Daniel Shahaf "Re: $* assignment regression in shwordsplit" (Apr 2, 5:58pm) References: <662d58a2-94fd-657c-e414-452f48ef47fc@inlv.org> <20170402175851.GA10565@fujitsu.shahaf.local2> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: $* assignment regression in shwordsplit MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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);