zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] NEWS and README items about ERR_EXIT and ERR_RETURN changes
@ 2022-12-12 16:06 Philippe Altherr
  2022-12-12 16:28 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Altherr @ 2022-12-12 16:06 UTC (permalink / raw)
  To: Zsh hackers list


[-- Attachment #1.1: Type: text/plain, Size: 84 bytes --]

Here is an updated patch to document the ERR_EXIT and ERR_RETURN changes.

Philippe

[-- Attachment #1.2: Type: text/html, Size: 146 bytes --]

[-- Attachment #2: patch-errexit-news-and-readme.txt --]
[-- Type: text/plain, Size: 3022 bytes --]

diff --git a/NEWS b/NEWS
index cdafd1ff5..e3a16a8bc 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,14 @@ CHANGES FROM PREVIOUS VERSIONS OF ZSH
 
 Note also the list of incompatibilities in the README file.
 
+Changes since 5.9
+-----------------
+
+The ERR_EXIT and ERR_RETURN options were refined to be more self-
+consistent and better aligned with the POSIX-2017 specification of
+`set -e`. For details on what exactly changed, see the list of
+incompatibilities in the README file.
+
 Changes since 5.8.1
 -------------------
 
diff --git a/README b/README
index 21142e17c..cb6d380aa 100644
--- a/README
+++ b/README
@@ -31,8 +31,56 @@ Zsh is a shell with lots of features.  For a list of some of these, see the
 file FEATURES, and for the latest changes see NEWS.  For more
 details, see the documentation.
 
-Incompatibilities since 5.8.1
------------------------------
+Incompatibilities since 5.9
+---------------------------
+
+The ERR_EXIT and ERR_RETURN options were refined to be more self-
+consistent and better aligned with the POSIX-2017 specification of
+`set -e`:
+
+  - Function calls or anonymous functions prefixed with `!` now never
+    trigger exit or return. Negated function calls or anonymous
+    functions used to trigger exit or return if ERR_EXIT or ERR_RETURN
+    was set and the function call or anonymous function returned a
+    zero exit status. Example:
+
+      setopt ERR_EXIT
+      f() { true }
+      ! f
+      echo "This is printed only since 5.10."
+
+  - The `always` command now ignores ERR_EXIT and ERR_RETURN, as other
+    complex commands do, if its exit status comes from a command
+    executed while the option is ignored. Example:
+
+      setopt ERR_EXIT
+      { false && true } always { echo "This was and still is printed." }
+      echo "This is printed only since 5.10."
+
+  - Function calls, anonymous functions, and the `eval`, `.`, and
+    `source` builtins now never ignore ERR_EXIT and ERR_RETURN on
+    their own. These commands used to ignore ERR_EXIT and ERR_RETURN
+    if their result came from a complex command (if, for, ...) whose
+    result came from a command executed while the option is
+    ignored. Example:
+
+      setopt ERR_EXIT
+      f() { if true; then false && true; fi }
+      f
+      echo "This is printed only prior to 5.10."
+
+  - The `&&` and `||` operators now always ignore ERR_RETURN in their
+    left operand. Until this version, the operators failed to ignored
+    ERR_RETURN in their left operand if they were executed as part of
+    a function call or an anonymous function that was itself executed
+    in a context where ERR_RETURN is ignored. Example:
+
+      setopt ERR_RETURN
+      f() { { false; echo "This is printed only since 5.10." } || true }
+      if f; then true; fi
+
+Incompatibilities between 5.8.1 and 5.9
+---------------------------------------
 
 compinit: A "y" response to the "Ignore ... and continue?" prompt removes
 insecure elements from the set of completion functions, where previously

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

* Re: [PATCH] NEWS and README items about ERR_EXIT and ERR_RETURN changes
  2022-12-12 16:06 [PATCH] NEWS and README items about ERR_EXIT and ERR_RETURN changes Philippe Altherr
@ 2022-12-12 16:28 ` Bart Schaefer
  2022-12-12 23:14   ` Philippe Altherr
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2022-12-12 16:28 UTC (permalink / raw)
  To: Philippe Altherr; +Cc: Zsh hackers list

On Mon, Dec 12, 2022 at 8:08 AM Philippe Altherr
<philippe.altherr@gmail.com> wrote:
>
> Here is an updated patch to document the ERR_EXIT and ERR_RETURN changes.

Thanks.

> +      echo "This is printed only since 5.10."

For the group:  More likely to be 5.9.1 ?


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

* Re: [PATCH] NEWS and README items about ERR_EXIT and ERR_RETURN changes
  2022-12-12 16:28 ` Bart Schaefer
@ 2022-12-12 23:14   ` Philippe Altherr
  2022-12-13  3:20     ` Daniel Shahaf
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Altherr @ 2022-12-12 23:14 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]

Hmm, I think all occurrences of "5.10" could be replaced with "this
version", which would avoid the problem of knowing what the future version
number will be.

Philippe


On Mon, Dec 12, 2022 at 5:28 PM Bart Schaefer <schaefer@brasslantern.com>
wrote:

> On Mon, Dec 12, 2022 at 8:08 AM Philippe Altherr
> <philippe.altherr@gmail.com> wrote:
> >
> > Here is an updated patch to document the ERR_EXIT and ERR_RETURN changes.
>
> Thanks.
>
> > +      echo "This is printed only since 5.10."
>
> For the group:  More likely to be 5.9.1 ?
>

[-- Attachment #2: Type: text/html, Size: 1006 bytes --]

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

* Re: [PATCH] NEWS and README items about ERR_EXIT and ERR_RETURN changes
  2022-12-12 23:14   ` Philippe Altherr
@ 2022-12-13  3:20     ` Daniel Shahaf
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Shahaf @ 2022-12-13  3:20 UTC (permalink / raw)
  To: zsh-workers

Philippe Altherr wrote on Mon, 12 Dec 2022 23:14 +00:00:
> On Mon, Dec 12, 2022 at 5:28 PM Bart Schaefer <schaefer@brasslantern.com>
> wrote:
>
>> On Mon, Dec 12, 2022 at 8:08 AM Philippe Altherr
>> <philippe.altherr@gmail.com> wrote:
>> >
>> > Here is an updated patch to document the ERR_EXIT and ERR_RETURN changes.
>>
>> Thanks.
>>
>> > +      echo "This is printed only since 5.10."
>>
>> For the group:  More likely to be 5.9.1 ?
>>
> 
> Hmm, I think all occurrences of "5.10" could be replaced with "this
> version", which would avoid the problem of knowing what the future version
> number will be.

It would be nice to actually say the version number, to make the
sentence as self-contained as possible.  (People might read that section
after upgrading directly from 5.9 to 5.11, or might want to copy-paste
that sentence into a mailing list post, etc..)

No opinion on what the next release's version number should be.  That
would depend on what changes are in master when we create that release.
For now, I guess you can just put in the text whatever version number you
put in the section's title?  We will presumably proofread that section if we
retitle it.

Cheers,

Daniel


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

end of thread, other threads:[~2022-12-13  3:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12 16:06 [PATCH] NEWS and README items about ERR_EXIT and ERR_RETURN changes Philippe Altherr
2022-12-12 16:28 ` Bart Schaefer
2022-12-12 23:14   ` Philippe Altherr
2022-12-13  3:20     ` Daniel Shahaf

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