Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16014
| From | Eli Schwartz <eschwartz@archlinux.org> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: command_not_found_handle() flaw |
| Date | 2020-03-10 16:31 -0400 |
| Message-ID | <mailman.2432.1583872324.2412.bug-bash@gnu.org> (permalink) |
| References | <CAJOr74gyTOEnYNCG3EPAVJq5VkmJxJ_9tv_TwbmKPBGugdvnWw@mail.gmail.com> <7900c11e-7c5c-1b2b-2ed5-7203bd73c2a9@case.edu> <CAJOr74gZy--_utO8JA8SY8je+tCgfpRZfX_6rkn31euPx2Jbkg@mail.gmail.com> <20200310200429.GB845@eeg.ccf.org> <8a003206-566b-93bb-222d-ea68a7be657b@archlinux.org> |
[Multipart message — attachments visible in raw view] - view raw
On 3/10/20 4:04 PM, Greg Wooledge wrote:
> On Tue, Mar 10, 2020 at 08:57:26PM +0100, Phi Debian wrote:
>> Secondly, if yuio insist on going on the subshell path, then $$ and $PPID
>> ought to be setup appropriately, here ther are plain bogus.
>
> wooledg:~$ command_not_found_handle() { echo "\$\$=$$ BASHPID=$BASHPID"; }
> wooledg:~$ echo "\$\$=$$ BASHPID=$BASHPID"
> $$=859 BASHPID=859
> wooledg:~$ wyeiruwyer
> $$=859 BASHPID=15619
>
> It looks correct to me. $$ is the PID of the main script, and $BASHPID
> is the PID of the subshell.
I think perhaps what the reporter did not realize is that this is the
expected behavior of a subshell.
$ command_not_found_handle; (command_not_found_handle); sddssdfcdsfsf
$$=20819 BASHPID=20819
$$=20819 BASHPID=40810
$$=20819 BASHPID=40811
i.e. $$ doesn't change, whether invoked via command_not_found_handle or
any other form of subshell.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
Back to gnu.bash.bug | Previous | Next | Find similar
Re: command_not_found_handle() flaw Eli Schwartz <eschwartz@archlinux.org> - 2020-03-10 16:31 -0400
csiph-web