From: Martijn Dekker <martijn@inlv.org>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: errexit and (Z)ERR trap regression
Date: Thu, 20 Jun 2024 18:12:43 +0100 [thread overview]
Message-ID: <5d54375e-8673-45f0-b5ac-f5e0e233d56f@inlv.org> (raw)
Two manifestations of the same bug in the current dev version:
$ zsh -e -c 'true && false; echo NOT REACHED' # no output; correct
$ zsh -c 'true && (set -e; false; echo NOT REACHED)' # incorrect output
NOT REACHED
and
$ zsh -c 'trap "echo Trapped!" ERR; true && false' # correct output
Trapped!
$ zsh -c 'true && (trap "print Trapped!" ERR; false)' # no output; bug
The -e option and the (Z)ERR trap should be disabled for the left hand side of
&&/|| but not for the right hand side (or, as POSIX puts it, set -e should be
disabled for "any command of an AND-OR list other than the last"). zsh 5.8.x
works correctly.
A 'git bisect' revealed that this bug was introduced in:
commit 259f1e944b96715fda25f7ba227da05bdb7e600f
Author: Philippe Altherr <philippe.altherr@gmail.com>
Date: Sat Dec 3 21:03:36 2022 -0800
51071: fix ERR_RETURN for functions in conditional statements
--
|| modernish -- harness the shell
|| https://github.com/modernish/modernish
||
|| KornShell lives!
|| https://github.com/ksh93/ksh
next reply other threads:[~2024-06-20 17:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-20 17:12 Martijn Dekker [this message]
2024-06-21 18:46 ` Bart Schaefer
2024-06-21 20:02 ` Lawrence Velázquez
2024-06-21 20:36 ` Bart Schaefer
2024-06-22 5:49 ` Lawrence Velázquez
2024-06-24 23:02 ` Bart Schaefer
2024-06-26 12:42 ` Philippe Altherr
2024-06-26 21:43 ` Bart Schaefer
2024-06-27 2:01 ` Philippe Altherr
2024-06-27 16:43 ` Bart Schaefer
2024-06-27 17:09 ` Philippe Altherr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5d54375e-8673-45f0-b5ac-f5e0e233d56f@inlv.org \
--to=martijn@inlv.org \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).