From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22133 invoked by alias); 9 Jun 2010 15:54:52 -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: 28015 Received: (qmail 5699 invoked from network); 9 Jun 2010 15:54:41 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) 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.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Wed, 9 Jun 2010 16:54:29 +0100 From: Peter Stephenson To: Zsh hackers list Subject: Re: PATCH: bug in ${(z)...} with newlines Message-ID: <20100609165429.7e19ca2c@csr.com> In-Reply-To: References: <15865.1276088859@csr.com> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.6 (GTK+ 2.18.9; i686-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 09 Jun 2010 15:54:29.0509 (UTC) FILETIME=[0B65D350:01CB07EC] X-Scanned-By: MailControl A_09_40_00 (www.mailcontrol.com) on 10.71.0.131 On Wed, 9 Jun 2010 07:34:47 -0700 Bart Schaefer wrote: > On Wed, Jun 9, 2010 at 6:07 AM, Peter Stephenson wrote: > > This must be a bug, mustn't it? > > > > % foo=$'one\ntwo' > > % print ${(z)foo} > > one ; two > > I'm pretty sure that's intentional, so that when the newline is > removed by splitting, the join is still a semantically equivalent > shell expression. Otherwise you can't do stuff like this: >... > > As far as splitting arguments goes, the newline is just whitespace. > > Yes, but (z) is really for parsing, not merely splitting. Hmm. I've only ever used (z) for splitting words (which is why it was 'z', since 's' was used), which is my memory of why it was introduced. Now you're telling me it's for something other than what it says in the manual, which just says parsing is to find the words, and I can't use it without jumping through hoops. Nor can I think of a case where I would use it to find lines of code. I can certainly believe the completion system, which uses the same code underneath, might be relying on undocumented 'intentional' features. -- 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