From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23391 invoked by alias); 5 Jul 2017 01:45:13 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41399 Received: (qmail 27314 invoked from network); 5 Jul 2017 01:45:13 -0000 X-Qmail-Scanner-Diagnostics: from kahlil.inlv.org by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(37.59.109.123):SA:0(-0.0/5.0):. Processed in 0.87363 secs); 05 Jul 2017 01:45:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: martijn@inlv.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at inlv.org does not designate permitted sender hosts) Subject: Re: [BUG] Solaris-specific program flow corruption after subshell error exit From: Martijn Dekker To: Bart Schaefer , Zsh hackers list References: <5258197e-1903-b188-f033-fc424a271077@inlv.org> <170226122919.ZM4443@torch.brasslantern.com> <170226233951.ZM7244@torch.brasslantern.com> <04c2e247-04d1-2a3a-56c4-e5491ac170e1@inlv.org> Message-ID: <3fdad338-54a5-c1f2-e752-976c7db3ce01@inlv.org> Date: Wed, 5 Jul 2017 03:37:00 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <04c2e247-04d1-2a3a-56c4-e5491ac170e1@inlv.org> Content-Type: multipart/mixed; boundary="------------0CC8043FEBD39A70E9586BBB" Content-Language: en-GB --------------0CC8043FEBD39A70E9586BBB Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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 --------------0CC8043FEBD39A70E9586BBB Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="test-40645.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="test-40645.patch" 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 --------------0CC8043FEBD39A70E9586BBB--