From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17641 invoked by alias); 20 Feb 2012 08:49:08 -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: 30234 Received: (qmail 3001 invoked from network); 20 Feb 2012 08:49:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <120220004858.ZM31095@torch.brasslantern.com> Date: Mon, 20 Feb 2012 00:48:58 -0800 In-reply-to: <120219154515.ZM7225@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: Bug with bash emulation regarding ':'" (Feb 19, 3:45pm) References: <20120129183644.6d49d237@pws-pc.ntlworld.com> <120131202909.ZM6076@torch.brasslantern.com> <120201082929.ZM7032@torch.brasslantern.com> <20120205201133.3bcd2b7f@pws-pc.ntlworld.com> <20120214174154.36268595@pwslap01u.europe.root.pri> <4F3AEE8D.9050705@case.edu> <20120215123641.01e5a4fd@pwslap01u.europe.root.pri> <120219154515.ZM7225@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Subject: Re: Bug with bash emulation regarding ':' MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Feb 19, 3:45pm, Bart Schaefer wrote: } } Consequently I tried this: } } if (spsep || !arrasg) { } - multsub(&val, PREFORK_NOSHWORDSPLIT, NULL, &isarr, NULL); } + multsub(&val, PREFORK_SINGLE|PREFORK_NOSHWORDSPLIT, NULL, } &isarr, NULL); } } This faithfully reproduces the bash behavior in several tests I tried. I should note that this wouldn't have been anywhere near this easy if PWS hadn't done the background work on passing the bitflags. Although all tests still pass (except the new one introduced by 30203 which must be tweaked), I should note the above changes the "native" zsh behavior as well. I woudn't imagine this is going to cause much trouble -- I found no uses of ${...=...} in the default $fpath, which includes the whole completion suite, etc. -- but it does mean we might want to make it conditional upon something. For example: Index: Src/subst.c --- ../zsh-forge/current/Src/subst.c 2012-02-12 13:31:49.000000000 -0800 +++ Src/subst.c 2012-02-20 00:32:30.000000000 -0800 @@ -2693,7 +2693,12 @@ *idend = '\0'; val = dupstring(s); if (spsep || !arrasg) { - multsub(&val, PREFORK_NOSHWORDSPLIT, NULL, &isarr, NULL); + /* POSIX requires PREFORK_SINGLE semantics here, but + * traditional zsh used PREFORK_NOSHWORDSPLIT. Base + * behavior on caller choice of PREFORK_SHWORDSPLIT. */ + multsub(&val, + spbreak ? PREFORK_SINGLE : PREFORK_NOSHWORDSPLIT, + NULL, &isarr, NULL); } else { if (spbreak) split_flags = PREFORK_SPLIT|PREFORK_SHWORDSPLIT; I'd be just as happy going with PREFORK_SINGLE unconditionally, I think, but I hesitate to change anything arbitrarily. Either way, here is the tweak to the test suite: Index: Test/D04parameter.ztst --- ../zsh-forge/current/Test/D04parameter.ztst 2012-02-12 13:31:49.000000000 -0800 +++ Test/D04parameter.ztst 2012-02-19 23:46:19.000000000 -0800 @@ -267,7 +267,9 @@ : ${test_split_var:=$(test_splitting)} echo "_${test_split_var}_") 0:SH_WORD_SPLIT inside $(...) inside ${...} ->_'one' 'two' 'three'_ +>_'one' +>'two' +>'three'_ print -l "${(f)$(print first line\\nsecond line\\nthird line)}" 0:${(f)$(...)}