Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
err_exit/err_return regression
- X-seq: zsh-workers 35747
- From: jsks <js.shirin@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: err_exit/err_return regression
- Date: Thu, 9 Jul 2015 13:33:09 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=iGkvSiDarNg8fjTdctanT1thJom1oKiG+OIoYTXFCzs=; b=Ofyxp/ifPcKW7QOodKzERcnvrV8/I96VH18tWrzJda/ixMApIiye1DnWEweM9FrIQn mErJUl6nOQYLE1FC4OFYNhVp+McGXMmiunhhre6jEgpnULSiVRxLYTQFgk5R3DXG80QR uZVt19Imu3naFQHjfrDU2rB3F2CHOm7Sqz9hDvaQB0wuIcpnyC0Ngt7IQW6g+ZEqW0jD AzxFS/ePnM6GjXuhG+up/ydfPsO32oKh8vT3xbRGILX2SzzNMdzMGmItiYvSwbssSX+Q 4UdbVudJS4uBOS1jScki/0FChgGQyitcO5ajcFhjAvMUS6rsysMNZY/8XfbRF0Rqdeqm 4kxQ==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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