Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: $PPID not updated when the PPID changes (parent killed)
- X-seq: zsh-workers 48875
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: $PPID not updated when the PPID changes (parent killed)
- Date: Tue, 18 May 2021 10:15:20 +0200
- Archived-at: <https://zsh.org/workers/48875>
- In-reply-to: <CAH+w=7bywj1X1fyPLgpmo_OoqBEN8PjEDxDeKP-tMR_O4g04tg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- References: <20210516152418.GA39669@zira.vinc17.org> <CAH+w=7a3y6MjrPQWnPc1O0ESroLesZXwaQ-_AxJB5XRk7xDj2Q@mail.gmail.com> <20210517202608.GA3255290@zira.vinc17.org> <CAH+w=7bhsp71vazSJ_9Un1btb4mrxBgUciUg4zfGv15LeUfT1g@mail.gmail.com> <YKLttAsFd4bl9waS@fullerene.field.pennock-tech.net> <CAH+w=7bywj1X1fyPLgpmo_OoqBEN8PjEDxDeKP-tMR_O4g04tg@mail.gmail.com>
On 2021-05-17 16:15:24 -0700, Bart Schaefer wrote:
> On Mon, May 17, 2021 at 3:27 PM Phil Pennock
> <zsh-workers+phil.pennock@xxxxxxxxxxxx> wrote:
> >
> > The initial parent process ID; that is, the process ID of the process
> > which created this shell process, at the time that it did so.
>
> This is pretty close to what I was thinking. Does "at the time"
> really add anything?
It would be better without it.
> > Just as for $$, the value is only set for the original shell and does
> > not dynamically change for implicit subshells (as created for (list)
> > and for pipelines).
>
> Except (list) is an explicit subshell, isn't it?
>
> > It's an attempt to be clearer that "if you run zsh within zsh,
> > that's not a subshell, sure _that_ gets $$ and $PPID reset".
>
> Indeed. I'm tempted to say
>
> Just as with $$, the value is updated only within a new shell
> that increases $SHLVL, and not in other subshells.
>
> And then clarify "a new shell" under SHLVL if necessary, but I hope it isn't.
The zsh man pages use "subshell" at various places. They should be
consistent on what a subshell is, perhaps have a clear definition
at one place, and say what happens when a subshell is created.
Note also that the following in the zshmodules(1) man page should be
updated too:
sysparams
A readonly associative array. The keys are:
[...]
ppid Returns the process ID of the parent of the current
process, even in subshells. Compare $PPID, which returns
the process ID of the parent of the main shell process.
This is even more confusing, because there are actually 2 differences
between $sysparams[ppid] and $PPID:
1. The fact that $sysparams[ppid] takes a new value in subshells, but
not $PPID.
2. The fact that $sysparams[ppid] is updated when the parent process
terminates, but not $PPID.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author