Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16013

Re: command_not_found_handle() flaw

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: command_not_found_handle() flaw
Date 2020-03-10 16:26 -0400
Message-ID <mailman.2431.1583872008.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> <84c68929-3fb4-6bf8-5c9e-871519d01880@case.edu>

Show all headers | View raw


On 3/10/20 3:57 PM, Phi Debian wrote:
> 
> Hi All,
> 
> I think it is a bug, it is not working as intended at least in the man
> page, it says.
> 
> If that function exists, it is invoked
>        with the original command and the original command's arguments  as  its
>        arguments,  and  the  function's exit status becomes the exit status of
>        the shell.  If that function is not defined, the shell prints an  error
>        message and returns an exit status of 127.

It's not clear what version of bash you're using, but the current version
of the man page says clearly that the function is invoked in "a separate
execution environment" and the "exit status becomes the exit status of that
subshell."

> 
> A function invocation, don't imply a sub shell.
> 
> Secondly, if yuio insist on going on the subshell path, then $$ and $PPID
> ought to be setup appropriately, here ther are plain bogus.

$$ doesn't change for separate execution environments like command and
process substitution, so it doesn't change here. The same with PPID.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: command_not_found_handle() flaw Chet Ramey <chet.ramey@case.edu> - 2020-03-10 16:26 -0400

csiph-web