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

Re: $PPID not updated when the PPID changes (parent killed)

On Tue, May 18, 2021 at 1:17 AM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> The zsh man pages use "subshell" at various places. They should be
> consistent on what a subshell is, perhaps have a clear definition

I believe that we are consistent in the usage of subshell in the docs,
but the wider world sometimes uses subshell to refer to any shell
started by another, e.g. in
  zsh -c 'bash -c "echo some people call me a subshell"'

> at one place, and say what happens when a subshell is created.

Frankly this is probably unhelpful except to people who want to make
RTFM references.  If "subshell" isn't a sufficiently understandable
term in isolation, nobody who isn't deliberately reading through the
entire manual is going to go looking for a definition when seeing
"subshell" in some other context.

> This is even more confusing, because there are actually 2 differences

It's only confusing because you're making yourself confused.

PPID is not a special variable.  (Something for which we DO have an
explicit definition).  That means the only way it changes is when
assigned to or unset.  It's been this way for 30 years and nobody ever
mentioned expecting it to change or being confused by that before you
in this thread.

sysparams[ppid] is explicitly a readonly API on a system call.  It
should be obvious from that that it changes if the value of the system
call would change.  It's been this way for 20-something years and
again no complaints.

It can't become necessary to spell out all the side effects of this
type of thing in every possible situation, it's just untenable.

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