zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: interrupt handling bug (again?)
Date: Fri, 30 Jun 2017 14:33:47 +0100	[thread overview]
Message-ID: <20170630143347.7f1c252c@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <170624120310.ZM30935@torch.brasslantern.com>

On Sat, 24 Jun 2017 12:03:10 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:

> On Jun 6,  9:08pm, Mikael Magnusson wrote:
> }
> } % for a in 1 2 3; do xterm; done
> } then hit ctrl-z in that term and bg it, do stuff and at some point hit
> } ctrl-c, the backgrounded for loop will be interrupted
> 
> I'm not 100% sure but this is most likely a TTY process group issue.
> 
> If I change "xterm" to
> 
> % for a in 1 2 3; do; sleep 10; echo $a; done
> 
> then I can reproduce the behavior on "bg".

Yes, this version is very straightforward to see.

> ...if you interrupt before the foreground job is done, the
> parent faithfully propagates the signal to the entry in the job
> table, and that kills the loop when it finally does restart.

I think that is happening, but I'm not sure where.

The shell forked to run the rest of the loop is running as a SUPERJOB
with a different PGID from the parent shell (I checked the latter
though haven't gone into the SUBJOB / SUPERJOB code again yet). I think
that means it should never need to get the SIGINT. The parent shell
knows (or can deduce simply by means of the job table) it's now not
associated with a foreground SUBJOB, so I don't see why it shouldn't be
able to handle this case properly.

Haven't tracked down the specific code, though.

pws


  reply	other threads:[~2017-06-30 13:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06 19:08 Mikael Magnusson
2017-06-24 19:03 ` Bart Schaefer
2017-06-30 13:33   ` Peter Stephenson [this message]
2017-06-30 21:16     ` Peter Stephenson
2017-07-02 19:32       ` Peter Stephenson
2017-07-02 20:05         ` Bart Schaefer
2017-07-02 20:22           ` Peter Stephenson
2017-07-03 15:09   ` Peter Stephenson
2017-07-10  9:36     ` 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=20170630143347.7f1c252c@pwslap01u.europe.root.pri \
    --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).