From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3605 invoked by alias); 12 Aug 2016 07:50:55 -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: 39028 Received: (qmail 26195 invoked from network); 12 Aug 2016 07:50:55 -0000 X-Qmail-Scanner-Diagnostics: from mail-pf0-f195.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.192.195):SA:0(0.0/5.0):. Processed in 0.166687 secs); 12 Aug 2016 07:50:55 -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.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable 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: none (ns1.primenet.com.au: domain at brasslantern.com does not designate permitted sender hosts) 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=zuGc672Ww+HCZw7qA8Os2rcp3Q+ctlCt0PUe2eDIKu8=; b=A8otFy6tzHdRclsz+YHeg2aFF5ZVg1b1DK2BDWP60BdpjtGLmSdfiViKWZIMyOmY2a czmEesdlYjCGmOX+XnD4NT9dSHX3I6mtih65SQKabz1UalQbhilamf+ZlJWSZAWBPZEU Sa1YEJMcRiNi/YyhZ/qL2P381Ayp+tF/Q+3qQJN0SLUm/o67Aj6vBxIEaDtK9kBGYZXk O1JkfSDigOVEAVzkeTJIO9GBD4DAVIBI7bFgUNzqHF45x448ZrzyTcBZ0pZuQHkuo2iA bsvpvGeTNLLEmYX2uy4N9if9kzd4cX74jY5fJj9wk9LkAZ51B63QPVdaAV2iKBHAQnLz lcbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=zuGc672Ww+HCZw7qA8Os2rcp3Q+ctlCt0PUe2eDIKu8=; b=Gnur9zoNZxDUs1qRmPkt6LMNWYaRgx8puII20NYsZdi76xYq5oXojlf57hUsqD7YzE L4To6sjIMz6drNAx406U64rvBfhIoghaRJ5ukSQFfE/CDQjRhRwRJXw2j+YAlXo3vWC3 dEcWPh9TyUTGTifjgajUxbcRER3syXFUZXlepDzWK1/7neo+d3z5n2aMHl6AQiu9Wtfe fsSsHxES4YtEtBpolJ2FNiNukwU/jWg1BmjnUvu2hQQ4oI7OsdspHCk1nFNYxDpmSyja zPbVVrvVGrr1GBgpy0SJmQITwpOGYRvuO8ReYkQV0zrUI0asnCk4kMvn1wV/Jq7TWOUQ FI1g== X-Gm-Message-State: AEkoouvSixByrA2yoxhuykqu0eb7+u63udstZ3GaN41799kPr0ZoOEiYFR2FEEJfo17Ltg== X-Received: by 10.98.98.193 with SMTP id w184mr24780546pfb.120.1470988246650; Fri, 12 Aug 2016 00:50:46 -0700 (PDT) From: Bart Schaefer Message-Id: <160812005044.ZM17236@torch.brasslantern.com> Date: Fri, 12 Aug 2016 00:50:44 -0700 In-Reply-To: <160811102803.ZM2533@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: [bug] shwordsplit not working on $@ when $# > 1" (Aug 11, 10:28am) References: <20160808111626.GA19766@chaz.gmail.com> <20160808192734.21923640@ntlworld.com> <160808182124.ZM9355@torch.brasslantern.com> <20160809094013.01f0f5f8@pwslap01u.europe.root.pri> <160810102836.ZM15324@torch.brasslantern.com> <20160811110545.1b066d2f@pwslap01u.europe.root.pri> <160811102803.ZM2533@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: [bug] shwordsplit not working on $@ when $# > 1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Aug 11, 10:28am, Bart Schaefer wrote: } } This is still broken after 39019 (sigh) because IFS= plus shwordsplit } implies that joining should not happen in other circumstances, and we } only split after joining, so that unintentionally bleeds into this. I } thought I'd got it worked out and that the tests I added covered it, } but trying this specific example again still fails. Back to prodding } at it, I guess. OK, this finally seems to both test and solve all the weird combos. Note the only difference from nojoin == 0 to nojoin == 1 in the case of force_split is that ms_flags is not cleared. I really don't follow what that's doing. diff --git a/Src/subst.c b/Src/subst.c index ae3e4c4..99e1650 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -3461,11 +3461,12 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags, val = sepjoin(aval, sep, 1); isarr = 0; ms_flags = 0; - } else if (force_split && nojoin == 2) { + } else if (force_split && (spsep || nojoin == 2)) { /* Hack to simulate splitting individual elements: - * first join on what we later use to split + * forced joining as previously determined, or + * join on what we later use to forcibly split */ - val = sepjoin(aval, spsep, 1); + val = sepjoin(aval, (nojoin == 1 ? sep : spsep), 1); isarr = 0; } } diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index 35630c5..460a841 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -1970,8 +1970,14 @@ set -- one:two bucklemy:shoe IFS= setopt shwordsplit - print -l ${@} + print -l ${@} ${(s.:.)*} ${(s.:.j.-.)*} ) -0:Joining of $@ does not happen when IFS is empty +0:Joining of $@ does not happen when IFS is empty, but splitting $* does >one:two >bucklemy:shoe +>one +>twobucklemy +>shoe +>one +>two-bucklemy +>shoe