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: Fri, 1 Sep 2023 08:48:13 -0700
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.14.0

On 2023-09-01 04:58, Martin D Kealey wrote:
On Fri, 1 Sep 2023, 15:51 Earl Chew, <earl_chew@yahoo.com <mailto:earl_chew@yahoo.com>> wrote:

    The controlling terminal must be reconfigured before the parent gets
to wait() for the job,
    and before the child gets to exec() the program (or their equivalents).

This second point makes sense, but I don't really see why the first point is necessary.
On reflection, I think you're right.

I was considering a general case, and also fussing about the case
where the parent yields when the effect must occur before the child
issues exec(), versus the case where the child acquires.

For the bash use cases, the IO side effects (read(), write(),
tcsetpgrp(), TIOCSWINSZ), and job control effects (SIGINT,
SIGTSTP, SIGQUIT), for the foreground process are either
ignored by the parent (eg SIGTSTP, SIGQUIT), or do not have
an effect in the parent until after the new job stops or exits.

What remains might be whether there is value in maintaining the
present barrier in both parent and child so that it is
straightforward to reason about designation of the
foreground process in the controlling terminal.

Earl


reply via email to

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