From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20867 invoked by alias); 14 Feb 2012 17:42:05 -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: 30218 Received: (qmail 10218 invoked from network); 14 Feb 2012 17:42:02 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Tue, 14 Feb 2012 17:41:54 +0000 From: Peter Stephenson To: Subject: Re: Bug with bash emulation regarding ':' Message-ID: <20120214174154.36268595@pwslap01u.europe.root.pri> In-Reply-To: <20120205201133.3bcd2b7f@pws-pc.ntlworld.com> References: <20120129183644.6d49d237@pws-pc.ntlworld.com> <120131202909.ZM6076@torch.brasslantern.com> <120201082929.ZM7032@torch.brasslantern.com> <20120205201133.3bcd2b7f@pws-pc.ntlworld.com> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.101.10.170] X-Scanned-By: MailControl 7.6.6 (www.mailcontrol.com) on 10.71.0.143 On Sun, 5 Feb 2012 20:11:33 +0000 Peter Stephenson wrote: > There's still a difference from bash... namely that in bash test_split_var= : ${test_split_var:=$(echo "one two three")} echo "$test_split_var" outputs the original string, with no splitting on the returned variable from the command substitution. zsh does split the command substitution before the assignment when in sh emulation (the same split array that later gets substituted onto the command line), so the newlines turn into spaces when the string is joined up again. However, test_split_var= echo ${test_split_var:=$(echo "one two three")} does perform splitting, evidently after the assignment has been done because the value assigned to test_split_var is (of course) as before. In zsh I'm not sure there's even a corresponding place where we could do splitting, even if we did something to fix the first difference, since it would have to be after multsub() returned in order to get the assignment to work as before, and at that point we don't want to screw up white space that was originally quoted, about which we no longer have any information. I don't know quite what ought to trigger behaviour to change the first difference, either (in principle I can fix this relatively easily, but it makes the second problem much more noticeable). It might or might not be the same condition as what triggers KSH_TYPESET, which in that case might want to be on in sh emulation even though that's not bash specific. At this point I lost the will to live. This will remain my definitive position until further notice. -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog