* Re: Bug#514857: zsh -c 'set -e; ! true; echo OK' fails
[not found] ` <20090211123454.GA20425@vin.lip.ens-lyon.fr>
@ 2009-03-25 14:57 ` Clint Adams
2009-03-25 16:31 ` Peter Stephenson
0 siblings, 1 reply; 2+ messages in thread
From: Clint Adams @ 2009-03-25 14:57 UTC (permalink / raw)
To: Vincent Lefevre, 514857, 519571, 520101; +Cc: zsh-workers
A trio regarding set -e:
On Wed, Feb 11, 2009 at 01:34:54PM +0100, Vincent Lefevre wrote:
> The command
>
> zsh -c 'set -e; ! true; echo OK'
>
> fails to output OK, thus does not conform to POSIX:
>
> -e When this option is on, if a simple command fails for any of the
> reasons listed in Section 2.8.1 (on page 2315) or returns an exit
> status value >0, and is not part of the compound list following a
> while, until, or if keyword, and is not a part of an AND or OR
> list, and is not a pipeline preceded by the ! reserved word, then
> the shell shall immediately exit.
>
> bash, dash and ksh93 are correct (but not pdksh, posh and zsh).
>
> There's currently a discussion about "set -e" in the austin group
> mailing-list, but there does not seem to be any ambiguity on the
> above point, as only "! true" returns an exit status value >0 but
> this is not a simple command. And concerning historical behavior,
> both ksh93 and bash output OK. So, I think that pdksh, posh and
> zsh should follow.
On Fri, Mar 13, 2009 at 03:51:34PM +0100, Vincent Lefevre wrote:
> According to the new "set -e" proposal
>
> http://www.opengroup.org/austin/mailarchives/ag/msg18258.html
>
> zsh -c 'set -e; ! if true; then false; fi; echo $?'
>
> should output 0, i.e. "false" should not make the shell exit, because
> it is under a "!" context (even though "!" doesn't apply on the "false"
> command directly).
>
> Note that every other shell (bash, ksh93, pdksh, dash, posh) output 0.
On Tue, Mar 17, 2009 at 12:46:20PM +0100, Vincent Lefevre wrote:
> POSIX shells (bash, dash, ksh93, pdksh, posh) return with no output
> and an exit status equal to 1 on:
>
> sh -c 'set -e; foo() { false && false; }; foo; echo $?'
>
> but zsh doesn't, even with "emulate sh":
>
> $ zsh -fc 'emulate sh; set -e; foo() { false && false; }; foo; echo $?'
> 1
>
> zsh should match the existing practice (perhaps even without
> "emulate sh", unless this can break too many zsh scripts).
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Bug#514857: zsh -c 'set -e; ! true; echo OK' fails
2009-03-25 14:57 ` Bug#514857: zsh -c 'set -e; ! true; echo OK' fails Clint Adams
@ 2009-03-25 16:31 ` Peter Stephenson
0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2009-03-25 16:31 UTC (permalink / raw)
To: 514857, 519571, 520101, zsh-workers
Clint Adams wrote:
> A trio regarding set -e:
I am not going anywhere near this until the clarification in the
standard gets through.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-03-25 16:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20090317114619.GA12579@vin.lip.ens-lyon.fr>
[not found] ` <20090313145134.GA23870@vin.lip.ens-lyon.fr>
[not found] ` <20090211123454.GA20425@vin.lip.ens-lyon.fr>
2009-03-25 14:57 ` Bug#514857: zsh -c 'set -e; ! true; echo OK' fails Clint Adams
2009-03-25 16:31 ` Peter Stephenson
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).