zsh-workers
 help / color / mirror / code / Atom feed
From: "Lawrence Velázquez" <larryv@zsh.org>
To: "Bart Schaefer" <schaefer@brasslantern.com>
Cc: zsh-workers@zsh.org
Subject: Re: errexit and (Z)ERR trap regression
Date: Fri, 21 Jun 2024 16:02:42 -0400	[thread overview]
Message-ID: <2a5f0fa7-23bf-4069-b237-d304965f142e@app.fastmail.com> (raw)
In-Reply-To: <CAH+w=7YatfKy+vFT1dua5-6cxsgXDaj=GA2qye_nC7fWQ1xUSQ@mail.gmail.com>

On Fri, Jun 21, 2024, at 2:46 PM, Bart Schaefer wrote:
> Is my recollection incorrect, that there's a change related to this in
> the as-yet-unpublished next revision of POSIX?

There is a change, but it doesn't seem to be relevant here:
https://www.austingroupbugs.net/view.php?id=1150#c4184

The full description of "set -e" in the fresh-out-of-the-oven
POSIX.1-2024 is:

-e	When this option is on, when any command fails (for any of
	the reasons listed in Section 2.8.1 or by returning an exit
	status greater than zero), the shell immediately shall exit,
	as if by executing the `exit' special built-in utility with
	no arguments, with the following exceptions:

	1.	The failure of any individual command in a multi-command
		pipeline, or of any subshell environments in which
		command substitution was performed during word
		expansion, shall not cause the shell to exit.  Only
		the failure of the pipeline itself shall be considered.

	2.	The `-e' setting shall be ignored when executing
		the compound list following the `while', `until',
		`if', or `elif' reserved word, a pipeline beginning
		with the `!' reserved word, or any command of an
		AND-OR list other than the last.

	3.	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 requirement applies to the shell environment and each
	subshell environment separately.  For example, in:

		set -e; (false; echo one) | cat; echo two

	the `false' command causes the subshell to exit without
	executing `echo one'; however, `echo two' is executed because
	the exit status of the pipeline `(false; echo one) | cat'
	is zero.

	In

		set -e; echo $(false; echo one) two

	the `false' command causes the subshell in which the command
	substitution is performed to exit without executing `echo
	one'; the exit status of the subshell is ignored and the
	shell then executes the word-expanded command `echo two'.

-- 
vq


  reply	other threads:[~2024-06-21 20:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-20 17:12 Martijn Dekker
2024-06-21 18:46 ` Bart Schaefer
2024-06-21 20:02   ` Lawrence Velázquez [this message]
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=2a5f0fa7-23bf-4069-b237-d304965f142e@app.fastmail.com \
    --to=larryv@zsh.org \
    --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).