Re: PATCH: subshell into a new process group

"Anthony Heading" <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <[email protected]>
On Sun, May 10, 2026, at 1:43 PM, Bart Schaefer wrote:
> I don't think it needs a new ESUB flag.  I've tried several test cases
> and can't find any way in which the following results in materially
> different behavior (other than the intended).  Anyone?  With this, the
> process group has already been changed before "disown".

Is that not too big a change? Consider eg

setsid zsh -c '(sleep 1 && echo alive) & kill -- -$$'

I'd expect that to continue to kill everything, and was thinking
that the extra flag is needed if we want the subshell to survive
only if we use '&!' instead.

It's made confusing by the fact that ESUB_PGRP is a misnomer,
it's applied to every call path except one (very unusual) area
something to do with pipelines where the call omits the flag:
   entersubsh(ESUB_ASYNC, NULL);
but immediately (after a long comment) does this manually anyway:
  setpgrp(0L, mypgrp = getpid()); 

I think the idea is that ESUB_PGRP really indicates whether jobtable
bookkeeping is supposed to be reset, not whether we want a new
process group.  The flags could be reworked to be more explanatory
(current ESUB_PGRP could be inverted to be eg ESUB_CONTINUATION and
passed only for the one special case, etc), but it would be a lot of
mechanical code churn.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.