zsh-workers
 help / color / mirror / code / Atom feed
* errexit and (Z)ERR trap regression
@ 2024-06-20 17:12 Martijn Dekker
  2024-06-21 18:46 ` Bart Schaefer
  0 siblings, 1 reply; 11+ messages in thread
From: Martijn Dekker @ 2024-06-20 17:12 UTC (permalink / raw)
  To: Zsh hackers list

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


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

end of thread, other threads:[~2024-06-27 17:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-20 17:12 errexit and (Z)ERR trap regression Martijn Dekker
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

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