zsh-workers
 help / color / mirror / code / Atom feed
From: "Lawrence Velázquez" <larryv@zsh.org>
To: "Philippe Altherr" <philippe.altherr@gmail.com>,
	"Bart Schaefer" <schaefer@brasslantern.com>
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH] More ERR_EXIT (was Re: Tests RE behavior of ERR_EXIT)
Date: Tue, 15 Nov 2022 21:41:27 -0500	[thread overview]
Message-ID: <68e48647-7713-4b77-b719-d836d2671b06@app.fastmail.com> (raw)
In-Reply-To: <CAGdYchucse2HcYKHsA6Y9DrQ-21yTV=xLpvfJE=VWHbAX7C_nA@mail.gmail.com>

On Tue, Nov 15, 2022, at 2:18 PM, Philippe Altherr wrote:
> Here is a patch with which all tests pass (the Zsh ones, including the 
> new ones that the patch adds, and my tests mentioned in this thread). 

Here are two additional cases that your patch does not cover.  They
are not regressions, as stable zsh 5.9 is also affected.

As you've mentioned several times, POSIX states:

	If the exit status of a compound command other than a
	subshell command was the result of a failure while -e was
	being ignored, then -e shall not apply to this command.

This implies that ignored non-zero exit statuses may "bubble up"
until reaching a (...) command or a simple command.  You've already
mentioned function calls, but *any* simple command that derives its
exit status from "the last command executed" should be able to
trigger early exit.  At a minimum, this includes the dot/source and
eval commands, neither of which currently behaves correctly.

-----

	% cat /tmp/dotting.sh; echo
	. /tmp/dotted.sh
	echo done

	% cat /tmp/dotted.sh; echo
	if true; then
	    false && true
	fi

	% bash -e /tmp/dotting.sh; echo $?
	1
	% ksh -e /tmp/dotting.sh; echo $?
	1
	% dash -e /tmp/dotting.sh; echo $?
	1
	% yash -e /tmp/dotting.sh; echo $?
	1
	% zsh -e /tmp/dotting.sh; echo $?
	done
	0
	% Src/zsh -e /tmp/dotting.sh; echo $?
	done
	0

-----

	% cat /tmp/eval.sh; echo
	eval 'if true; then false && true; fi'
	echo done

	% bash -e /tmp/eval.sh; echo $?
	1
	% ksh -e /tmp/eval.sh; echo $?
	1
	% dash -e /tmp/eval.sh; echo $?
	1
	% yash -e /tmp/eval.sh; echo $?
	1
	% zsh -e /tmp/eval.sh; echo $?
	done
	0
	% Src/zsh -e /tmp/eval.sh; echo $?
	done
	0

-- 
vq


  parent reply	other threads:[~2022-11-16  2:42 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-12 22:16 Philippe Altherr
2022-11-13  3:59 ` Philippe Altherr
2022-11-13  4:11   ` Bart Schaefer
2022-11-13 13:55     ` Philippe Altherr
2022-11-13 14:24       ` Philippe Altherr
2022-11-13 15:45         ` Philippe Altherr
2022-11-13 16:52           ` Bart Schaefer
2022-11-13 16:45       ` Bart Schaefer
2022-11-13 16:53         ` Bart Schaefer
2022-11-13 18:37           ` Philippe Altherr
2022-11-13 20:55             ` Philippe Altherr
2022-11-13 22:27               ` Bart Schaefer
2022-11-13 23:10               ` Lawrence Velázquez
2022-11-13 22:12             ` Bart Schaefer
2022-11-15  1:11         ` Bart Schaefer
2022-11-15  7:01           ` [PATCH] Even more ERR_EXIT (was Re: More ERR_EXIT " Bart Schaefer
2022-11-15  7:30             ` Philippe Altherr
2022-11-15 19:50               ` Philippe Altherr
2022-11-15  7:26           ` [PATCH] More ERR_EXIT (was " Philippe Altherr
2022-11-15 19:18             ` Philippe Altherr
2022-11-15 21:08               ` Bart Schaefer
2022-11-16  2:41               ` Lawrence Velázquez [this message]
2022-11-16  6:31                 ` Philippe Altherr
2022-11-16  5:51               ` Bart Schaefer
2022-11-16  7:56                 ` Philippe Altherr
2022-11-16 14:21                   ` Philippe Altherr
  -- strict thread matches above, loose matches on Subject: below --
2022-11-09  5:29 Tests RE behavior of ERR_EXIT Bart Schaefer
2022-11-10  5:22 ` [PATCH] More ERR_EXIT (was Re: Tests RE behavior of ERR_EXIT) Bart Schaefer
2022-11-10  5:47   ` Bart Schaefer

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=68e48647-7713-4b77-b719-d836d2671b06@app.fastmail.com \
    --to=larryv@zsh.org \
    --cc=philippe.altherr@gmail.com \
    --cc=schaefer@brasslantern.com \
    --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).