From: Peter Stephenson <Peter.Stephenson@csr.com>
To: <zsh-workers@zsh.org>
Subject: Re: Bug in sh emulation
Date: Mon, 12 Dec 2011 10:01:00 +0000 [thread overview]
Message-ID: <20111212100100.0696825b@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <111211153918.ZM32739@torch.brasslantern.com>
On Sun, 11 Dec 2011 15:39:18 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> } - attachtty() works because SIGTTOU is still ignored
>
> I think there's a flaw here: attachtty() doesn't *work*, in that it
> won't actually associate the new process group with the TTY. Instead
> it just won't result in an infinite loop.
I'll check in more detail later, but I'm pretty sure this is how it
*always* works, not just in the case we're looking at. In most cases
the parent shell just lets the new process (whatever it's doing, just as
long as it's in the foreground) grab the terminal --- if you search the
code for attachtty(), and ignore the cases where we attaching to mypgrp,
the shell's own process group, the only other ones in the parent shell
are special cases. Instrumenting attachtty() didn't show any point
where the parent shell handed the tty over, and if you look at the GNU
documentation I pointed to, although it says both the parent shell and
the new process should perform the handover to minimise races, the
example code just does it from within the new process.
So I think (i) the attachtty() works in the subprocess so long as
SIGTTOU is blocked (ii) if that's not the case, we've got a far worse
problem than just shell compatibility (and I have no direct evidence we
have such a problem).
--
Peter Stephenson <pws@csr.com> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
next prev parent reply other threads:[~2011-12-12 10:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-10 1:39 Ivan S. Freitas
2011-12-10 2:47 ` Bart Schaefer
2011-12-10 3:40 ` Bart Schaefer
2011-12-10 18:15 ` Peter Stephenson
2011-12-10 19:40 ` Peter Stephenson
2011-12-10 23:28 ` Peter Stephenson
2011-12-11 19:39 ` Peter Stephenson
2011-12-11 20:20 ` Peter Stephenson
2011-12-11 20:56 ` Peter Stephenson
2011-12-11 23:39 ` Bart Schaefer
2011-12-12 10:01 ` Peter Stephenson [this message]
2011-12-12 10:14 ` Peter Stephenson
2011-12-12 15:44 ` Bart Schaefer
2011-12-12 16:06 ` Peter Stephenson
2011-12-12 18:10 ` Bart Schaefer
2011-12-12 19:16 ` Peter Stephenson
2011-12-11 22:37 ` Bart Schaefer
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=20111212100100.0696825b@pwslap01u.europe.root.pri \
--to=peter.stephenson@csr.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).