about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilippe Altherr <philippe.altherr@gmail.com>2022-12-13 21:01:47 -0800
committerBart Schaefer <schaefer@zsh.org>2022-12-13 21:01:47 -0800
commit8a45f16d83b0c4582a51e492e73595bf3321d580 (patch)
tree412bcc7024b6aafd2cb5874800ca465e1c07a87b
parent67d4bf5bb936a5b95160410b4790f2bf4113c75f (diff)
downloadzsh-8a45f16d83b0c4582a51e492e73595bf3321d580.tar.gz
zsh-8a45f16d83b0c4582a51e492e73595bf3321d580.tar.xz
zsh-8a45f16d83b0c4582a51e492e73595bf3321d580.zip
51193: Discuss ERR_EXIT changes
-rw-r--r--ChangeLog4
-rw-r--r--NEWS8
-rw-r--r--README52
3 files changed, 62 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index d8672c028..747d3eba3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2022-12-13  Bart Schaefer  <schaefer@zsh.org>
+
+	* Philippe Altherr: 51193: NEWS, README: Discuss ERR_EXIT changes
+
 2022-12-12  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 51134: Doc/Zsh/options.yo: document interactions between
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