zsh-workers
 help / color / mirror / code / Atom feed
From: Martijn Dekker <martijn@inlv.org>
To: Bart Schaefer <schaefer@brasslantern.com>,
	Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] Solaris-specific program flow corruption after subshell error exit
Date: Wed, 5 Jul 2017 03:37:00 +0200	[thread overview]
Message-ID: <3fdad338-54a5-c1f2-e752-976c7db3ce01@inlv.org> (raw)
In-Reply-To: <04c2e247-04d1-2a3a-56c4-e5491ac170e1@inlv.org>

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

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

[-- Attachment #2: test-40645.patch --]
[-- Type: text/plain, Size: 787 bytes --]

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
 >17
 >19
 
+# Regression test for workers/40645
+  # Bug only occurs with POSIXBUILTINS active.
+  setopt POSIXBUILTINS
+  # 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

      reply	other threads:[~2017-07-05  1:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-26  5:36 Martijn Dekker
2017-02-26 20:29 ` Bart Schaefer
2017-02-26 22:55   ` Martijn Dekker
2017-02-27  7:39     ` Bart Schaefer
2017-02-27 14:00       ` Martijn Dekker
2017-07-05  1:37         ` Martijn Dekker [this message]

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=3fdad338-54a5-c1f2-e752-976c7db3ce01@inlv.org \
    --to=martijn@inlv.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).