zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
Cc: zsh-workers@zsh.org (Zsh hackers list)
Subject: Re: PATCH: minor condition fixes
Date: Fri, 19 Feb 2010 12:35:51 +0000	[thread overview]
Message-ID: <201002191235.o1JCZpY8027861@news01.csr.com> (raw)
In-Reply-To: <20100219121454.697a7ae7@news01>

Peter Stephenson wrote:
> On Fri, 19 Feb 2010 12:02:37 +0000
> Peter Stephenson <pws@csr.com> 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
  <space> 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 <pws@csr.com>            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


      reply	other threads:[~2010-02-19 12:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-19 12:02 Peter Stephenson
2010-02-19 12:14 ` Peter Stephenson
2010-02-19 12:35   ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201002191235.o1JCZpY8027861@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).