From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7656 invoked by alias); 27 Feb 2017 07:40:14 -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: 40654 Received: (qmail 5313 invoked from network); 27 Feb 2017 07:40:14 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net 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(205.235.26.22):SA:0(0.5/5.0):. Processed in 3.336082 secs); 27 Feb 2017 07:40:14 -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.5 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_SORBS_SPAM,RP_MATCHES_RCVD,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=LfY+=2I=brasslantern.com=schaefer@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at bounces.park01.gkg.net does not designate permitted sender hosts) X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=brasslantern-com.20150623.gappssmtp.com X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=LnOaA7uF0mm0aNB28td6Gh1/RWFlib68qyiBjiujjWg=; b=fSDyCaeENsNlnE9GwDe71gitMVGXXbzU0vdEIIESqoDH6BtRKjRKXsBBnqPVpEMJ8T sqzeCcSBYL5VxIFzLdAxuS8hqCq8iCNIOfUlinO/Svsb5aD1BBW2exd/bpEs7y+mPwxa EdjYkH8Q1G4oTIqd0Pmj8cIrDHHqS97sjad2yM3TZi6kKWg8GNZmVDRpncFvRNAOhiF6 XLIAi6KCLbf5aPC2N6+j/VurkAGFZjaJm9HUojIuLwO0QmLy9UNRRO2ia3ER37Ss/pcr k6TPf9DR4UMtVyl4TMulxF8nCZMMT0WQ8BZgJe2doYWQgDi3kXQj74L4dViMabI9C9hK r67Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=LnOaA7uF0mm0aNB28td6Gh1/RWFlib68qyiBjiujjWg=; b=RZw+McJL/rm4tEguzCdAnVi+x6GO1f+RlR1MyfZm1h7a7tAZPQQQsygf+QngHMm9G8 z+PVU1Oc6s5EP1uAfITFQTNqF6O+azTWxSAVGnr6XPfiBtTxvzq24DIu+o2MexDDlyM+ pU9bedyHVQIaDjVVvY76x2dFtvyOgY0UBiqDUJuxbGaEd8GWZFBUTkqJXqxTNWASaXDg eTLnVBNrArhtKQr6PjzzDHYRw84RTkCBpRZQMn9ObRwr0/n2s5aq3BuxSETYdaETriLZ bAc0tet0xAv6b7VuASsZRtGXHkT/rXBq78LL6Lrd0o7aLtHW9sIQ2NqJU7kUcoUJ2DEE 13bQ== X-Gm-Message-State: AMke39m/O82Ne/ydihIvww17BkK1l8sASIgldk10Q9PuTh9v/s4k6ZZFK1LnQ9OD2j9VAg== X-Received: by 10.31.198.199 with SMTP id w190mr5363095vkf.28.1488181181060; Sun, 26 Feb 2017 23:39:41 -0800 (PST) From: Bart Schaefer Message-Id: <170226233951.ZM7244@torch.brasslantern.com> Date: Sun, 26 Feb 2017 23:39:51 -0800 In-Reply-To: Comments: In reply to Martijn Dekker "Re: [BUG] Solaris-specific program flow corruption after subshell error exit" (Feb 26, 11:55pm) References: <5258197e-1903-b188-f033-fc424a271077@inlv.org> <170226122919.ZM4443@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Martijn Dekker , Zsh hackers list Subject: Re: [BUG] Solaris-specific program flow corruption after subshell error exit MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Feb 26, 11:55pm, Martijn Dekker wrote: } } So that appears to suggest that the problem is something to do with } invoking exit() and not _exit() upon exiting a subshell on error. Could } it be that the 'forked' flag contains the wrong value? "forked" is local to that function and is correct in that the "set" command has not forked from the (sub)shell in which it is running. The problem seems to be that this test is not sufficient in the case where we're exiting due to failure of a special builtin. Instead we also need to know whether the surrounding context is a subshell. You might think the global "subsh" in exec.c would record that, but it doesn't. 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? And then maybe somebody else can chime in with the right thing to be testing here. diff --git a/Src/exec.c b/Src/exec.c index 83d1513..6af4ddb 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -3996,6 +3996,7 @@ execcmd_exec(Estate state, Execcmd_params eparams, * classify as a builtin) we treat all errors as fatal. * The "command" builtin is not special so resets this behaviour. */ + forked |= zsh_subshell; fatal: if (redir_err || errflag) { if (!isset(INTERACTIVE)) {