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

err_exit/err_return regression



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



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