Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 'set -e' with '!' POSIX issue



Op 04-10-16 om 10:30 schreef Peter Stephenson:
> On Tue, 4 Oct 2016 09:45:38 +0200
> Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>> I thought that this was not supposed to change:
>>
>>   http://www.zsh.org/mla/workers/2009/msg00572.html
>>   http://www.zsh.org/mla/workers/2009/msg00574.html
>>
>> I haven't checked the current status for the other two cases.
> 
> The point I made there was I was waiting for things to clear up.  That
> was 7 years ago.  I'm not going to wait any longer for things to clear
> up...

FYI, your patch fixes the simple case ('! true'), but not the two more
complex cases mentioned back then:

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).

Thanks,

- M.



Messages sorted by: Reverse Date, Date, Thread, Author