Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] Solaris-specific program flow corruption after subshell error exit
- X-seq: zsh-workers 40654
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Martijn Dekker <martijn@xxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [BUG] Solaris-specific program flow corruption after subshell error exit
- Date: Sun, 26 Feb 2017 23:39:51 -0800
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=brasslantern-com.20150623.gappssmtp.com
- 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==
- In-reply-to: <c5d29308-f76f-01c9-4b1c-5c68d76be46c@inlv.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <5258197e-1903-b188-f033-fc424a271077@inlv.org> <170226122919.ZM4443@torch.brasslantern.com> <c5d29308-f76f-01c9-4b1c-5c68d76be46c@inlv.org>
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)) {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author