From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10164 invoked by alias); 19 Feb 2010 12:47:01 -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: 27724 Received: (qmail 1092 invoked from network); 19 Feb 2010 12:46:50 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,MISSING_HEADERS, SPF_HELO_PASS autolearn=no version=3.2.5 Received-SPF: none (ns2.melb.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Message-Id: <201002191235.o1JCZpY8027861@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs cc: zsh-workers@zsh.org (Zsh hackers list) Subject: Re: PATCH: minor condition fixes In-reply-to: <20100219121454.697a7ae7@news01> References: <22045.1266580957@csr.com> <20100219121454.697a7ae7@news01> Comments: In-reply-to Peter Stephenson message dated "Fri, 19 Feb 2010 12:14:54 +0000." Date: Fri, 19 Feb 2010 12:35:51 +0000 From: Peter Stephenson X-OriginalArrivalTime: 19 Feb 2010 12:35:51.0618 (UTC) FILETIME=[12577A20:01CAB160] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-09-22-10 (www.mailcontrol.com) on 10.68.0.127 Peter Stephenson wrote: > On Fri, 19 Feb 2010 12:02:37 +0000 > Peter Stephenson wrote: > > Then there's a problem I haven't fixed, which is for some reason in the > > test code the status is returning as 1 for an unrecognised condition > > whereas it should return 2 (and does at the command line). This shows > > up with: > > > > % eval '[[ -fail badly ]]' > > zsh: unknown condition: -fail > > % print $? > > 1 > > I think it's as simple as the following; certainly the documentation for > "eval" says quite clearly it returns the same status as executing the code > directly, and so does the principle of least surprise, so I don't see how > the current behaviour can be right. Interestingly, bash also returns status 1 on an unrecognised condition when it's in an eval (else status 258). I checked the standard, and it seems to agree with the zsh documentation (what I think I've now implemented): If there are no arguments, or only null arguments, eval shall return a zero exit status; otherwise, it shall return the exit status of the command defined by the string of concatenated arguments separated by characters. with no exception for errors. The only mention of errors is CONSEQUENCES OF ERRORS Default. which I think simply refers to whether or not the shell exits. -- 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