zsh-workers
 help / color / mirror / code / Atom feed
* err_exit/err_return regression
@ 2015-07-09 11:33 jsks
  2015-07-09 13:38 ` Peter Stephenson
  0 siblings, 1 reply; 9+ messages in thread
From: jsks @ 2015-07-09 11:33 UTC (permalink / raw)
  To: zsh-workers

Since patch 34065, with either err_exit or err_return set, zsh does
not exit/return given a nonzero exist status of a command following
'else'.

Example:

$ setopt err_return; if false; then :; else false; echo foo; fi
foo

However, command lists following 'if' and 'elif' work as expected.

$ setopt err_return; if true; then false; echo foo; else :; fi

In the execif function of loop.c, when executing the command list of
an else statement, given that lastval from the evaluation of the
previous if/elif is nonzero, the flag noerrexit is never reset to its
original value.

noerrexit = olderrexit ? olderrexit : lastval ? 2 : 0;

Unless I misunderstood the intended behaviour, didn't know how to
handle this with regards to the patch fixing for example return values
and for loops, so simply reporting.

/jsks


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-10-04  2:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-09 11:33 err_exit/err_return regression jsks
2015-07-09 13:38 ` Peter Stephenson
2015-09-29 15:43   ` Joshua Krusell
2015-09-29 18:54     ` Peter Stephenson
2015-09-29 20:52       ` Joshua Krusell
2015-09-30  1:09         ` Bart Schaefer
2015-10-01 20:32           ` Joshua Krusell
2015-10-04  0:26             ` Bart Schaefer
2015-10-04  2:58               ` Bart Schaefer

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