Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] Solaris-specific program flow corruption after subshell error exit

Op 27-02-17 om 15:00 schreef Martijn Dekker:
> Op 27-02-17 om 08:39 schreef Bart Schaefer:
>> The following is a hack and there should probably be another way to
>> handle this, but try the patch below to see if it fixes the issue?
> Indeed, that fixes it nicely.
>> And then maybe somebody else can chime in with the right thing to be
>> testing here.
> I'll await that with interest.

I was distracted by real life for a while and didn't notice you
committed that patch on the 4th of March, because the list remained
silent on it.

Meanwhile, just FYI: I just finally got around to trying Slackware Linux
14.2 and zsh (any version before 4th of March) has the same bug on that
system! On Slackware 14.1 and earlier, the bug does not happen. Your
patch fixes it on Slackware 14.2 as it does on Solaris. So it is not
Solaris-specific after all; perhaps it's an interaction with certain
versions of (g)libc.

Meanwhile I adapted my test script for this bug to the zsh test suite
(see attached patch).

- Martijn
diff --git a/Test/A05execution.ztst b/Test/A05execution.ztst
index 0804691..35efbc0 100644
--- a/Test/A05execution.ztst
+++ b/Test/A05execution.ztst
@@ -310,3 +310,17 @@ F:anonymous function, and a descriptor leak when backgrounding a pipeline
+# Regression test for workers/40645
+  # Bug only occurs with POSIXBUILTINS active.
+  # A dot script is needed to trigger the bug.
+  printf '%s' '
+    # Execution counter.
+    count=0
+    # Exiting from a subshell due to an error triggers the bug.
+    (set -o nonexistent_@_option) 2>/dev/null
+    # With the bug, this will be executed twice so "let" returns true (0).
+    let "(count += 1) > 1"
+  ' > 40645.t
+  . ./40645.t
+1:program flow corruption with POSIXBUILTINS after subshell error exit

Messages sorted by: Reverse Date, Date, Thread, Author