Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug in sh emulation



On Mon, 12 Dec 2011 07:44:17 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Dec 12, 10:01am, Peter Stephenson wrote:
> }
> } 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.
> 
> OK, I'm good with that, but are you sure that the correct pgrp is
> ending up attached?  I was concerned about the subshell pipeline not
> receiving tty signals before, but now I'm concerned about signals
> not going to the previously-attached group from which the subshell
> is taking control.

I think this must be OK (unless, of course, something is failing where I
don't see it).  The chunk of code in entersubsh() we've been staring at
is the one that's only executed if there's no group leader, and in that
case it creates its own process group and attaches that to the tty
immediately. So if that succeeds then by definition it's the process
group we're just starting in the foreground.  We get this twice (even
after the last patch): first the subshell puts itself in the
foreground, then the pipeline being run from the subshell puts itself
into the foreground. If we weren't doing job control in the subshell,
the second one wouldn't happen: the subshell and everything run from it
would be treated as a single foreground job (this is the normal case
for zsh native mode).

-- 
Peter Stephenson <pws@xxxxxxx>            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



Messages sorted by: Reverse Date, Date, Thread, Author