Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: job control debug
- X-seq: zsh-workers 43406
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: PATCH: job control debug
- Date: Fri, 7 Sep 2018 10:18:52 +0100
- Cms-type: 201P
- Dkim-filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180907091856euoutp02498c796b0110ebf3538fa608b86f346e~SE5DuVbsg2298622986euoutp02P
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536311936; bh=0vwjccIB0Kuq6sJiF/hKLcgJzYTUZtZLppRaUmD24bI=; h=Date:From:To:Subject:In-Reply-To:References:From; b=gRHrPKBAdxurQQBojan/llW21FrT1PRJg/XBj6fxjorKhgbIWeEDJ27y+V6/AclsU iY7YYCocnKy1/DNNEJPWUp+u8Ss3yZw+h9wsTcD4zs+PC8HTRa+DMyV6t7x5yOcn/I FKCoN3xIoSFx/sgGZubmtSj8eKhTu4Rq3xDd4dcg=
- In-reply-to: <CAH+w=7ZH1d8RZaHNVhb2k+RqBb_8kgxDurewtk1a6TWG9Vvh5Q@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: SCSC
- References: <CGME20180905200816epcas5p18ce6c49baa637e7d83a769e97c4364fb@epcas5p1.samsung.com> <20180905210740.5a6aec15@pws-HP.localdomain> <20180906090902.1f344e9f@camnpupstephen.cam.scsc.local> <20180906092250eucas1p13d651e07ae627d179dd0701e65f912d6~RxTLztJrP2263722637eucas1p12@eucas1p1.samsung.com> <CAH+w=7ZH1d8RZaHNVhb2k+RqBb_8kgxDurewtk1a6TWG9Vvh5Q@mail.gmail.com>
On Thu, 6 Sep 2018 20:18:14 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> In particular entersubsh() does some juggling of SIGTTOU -- which I
> think predates this bug appearing, but there may be an interaction of
> that with some later change.
That's definitely a good tip. We usually get here:
if (!job_control_ok) {
/*
* If this process is not going to be doing job control,
* we don't want to do special things with the corresponding
* signals. If it is, we need to keep the special behaviour:
* see note about attachtty() above.
*/
signal_default(SIGTTOU);
signal_default(SIGTTIN);
signal_default(SIGTSTP);
}
Sure enough, disabling this stops the problem happening. Note this is
not the case where there is no job control at all --- that's a separate
test. This is if we think we can't do job control in the current
subprocess even if we could in the parent.
What do you think of the following? If we are in list_pipe_job land, aka
Rimmerworld, and we're attached to the terminal, keep the current signal
behaviour.
My best guess about what's changed is a newly exposed race.
diff --git a/Src/exec.c b/Src/exec.c
index 09ee132..4861ae5 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1029,6 +1029,13 @@ entersubsh(int flags)
setpgrp(0L, jobtab[list_pipe_job].gleader);
if (!(flags & ESUB_ASYNC))
attachtty(jobtab[thisjob].gleader);
+ } else if (gettygrp() == GETPGRP()) {
+ /*
+ * There are races where if the process is attached
+ * to the terminal blocking SIGTTOU causes errors.
+ * So just leaves signals alone.
+ */
+ job_control_ok = 1;
}
}
else if (!jobtab[thisjob].gleader ||
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author