On 2023-09-01 04:58, Martin D Kealey wrote:
On Fri, 1 Sep 2023, 15:51 Earl Chew, <[email protected] <mailto:[email protected]>> wrote:The controlling terminal must be reconfigured before the parent getsto 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
