zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: PATCH: job control debug
Date: Fri, 7 Sep 2018 10:18:52 +0100	[thread overview]
Message-ID: <20180907091854eucas1p174b53ff65c00fc7e6c17c3b9832dfa80~SE5CIlxO91559115591eucas1p1o@eucas1p1.samsung.com> (raw)
In-Reply-To: <CAH+w=7ZH1d8RZaHNVhb2k+RqBb_8kgxDurewtk1a6TWG9Vvh5Q@mail.gmail.com>

On Thu, 6 Sep 2018 20:18:14 -0700
Bart Schaefer <schaefer@brasslantern.com> 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

  reply	other threads:[~2018-09-07  9:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180905200816epcas5p18ce6c49baa637e7d83a769e97c4364fb@epcas5p1.samsung.com>
2018-09-05 20:07 ` Peter Stephenson
2018-09-06  8:09   ` Peter Stephenson
     [not found]   ` <20180906090902.1f344e9f@camnpupstephen.cam.scsc.local>
2018-09-06  9:22     ` Peter Stephenson
2018-09-07  3:18       ` Bart Schaefer
2018-09-07  9:18         ` Peter Stephenson [this message]
     [not found]         ` <20180907101852.62415ff9@camnpupstephen.cam.scsc.local>
2018-09-07 11:21           ` Peter Stephenson
     [not found]           ` <20180907122145.2af5bcba@camnpupstephen.cam.scsc.local>
2018-09-07 14:01             ` PATCH: Rimmerworld pipeline race Peter Stephenson
     [not found]             ` <20180907150140.46a05880@camnpupstephen.cam.scsc.local>
2018-09-07 14:58               ` Peter Stephenson
2018-09-07 16:46                 ` Peter Stephenson
2018-09-07 23:40                   ` Bart Schaefer
2018-09-08 17:37                     ` Peter Stephenson
2018-09-08 18:40                       ` Peter Stephenson
2018-09-10 22:55                 ` Axel Beckert
2018-09-11  8:58                   ` Peter Stephenson
2018-09-11 14:40                     ` Vincent Lefevre
2018-09-11 15:03                       ` Peter Stephenson
     [not found]                       ` <20180911160326.33dfd575@camnpupstephen.cam.scsc.local>
2018-09-11 15:32                         ` Peter Stephenson

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='20180907091854eucas1p174b53ff65c00fc7e6c17c3b9832dfa80~SE5CIlxO91559115591eucas1p1o@eucas1p1.samsung.com' \
    --to=p.stephenson@samsung.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).