bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: give_terminal_to() / maybe_give_terminal_to() race


From: Earl Chew
Subject: Re: give_terminal_to() / maybe_give_terminal_to() race
Date: Thu, 7 Sep 2023 08:05:22 -0700
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.0

On 2023-09-05 08:46, Chet Ramey wrote:
Such as? If the parent doesn't need to change the terminal process group,
synchronizes with the pipeline via waitpid(), and doesn't attempt to change
the terminal process group back until all children in that process group
have stopped or exited, what consequences are of concern?

I think the only other side-effects relate to IO (eg SIGTTIN, SIGTTOU),
but as far as I can tell these are not of concern since the parent stays
quiet until the foreground job either stops or completes.

Given that the children must synchronise before exec(), there is no
issue if all configure the terminal though it is sufficient
if only the first child does so.

Not true; ...

You're right, I have that backwards. If only one child configures the
terminal, then the siblings must wait until that child has completed
doing so before they invoke exec(). Rather than do that, given that
subsequent invocations of give_terminal_to() (ie tcsetpgrp()) by siblings
will find the foreground group already configured, it makes sense to
simply let every sibling do so.

Earl


reply via email to

[Prev in Thread] Current Thread [Next in Thread]