Re: command_not_found_handle() flaw

2020-03-11 Thread Phi Debian
Hi All, Ok I got the picture now, and I owe you some apologize, but with what I got in front of me (ubuntu 20.04, bash-git latest) mistake from my side was easy to do. Regarding the docco, I admit I got the latest bash source (git) BUT I read the ubuntu 20.04 doc, that still DON'T mention the sep

Re: command_not_found_handle() flaw

2020-03-10 Thread Eli Schwartz
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 "\$\$=

Re: command_not_found_handle() flaw

2020-03-10 Thread Chet Ramey
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

Re: command_not_found_handle() flaw

2020-03-10 Thread Greg Wooledge
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 "\$\$=$$

Re: command_not_found_handle() flaw

2020-03-10 Thread Phi Debian
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

Re: command_not_found_handle() flaw

2020-03-10 Thread Chet Ramey
On 3/10/20 1:37 PM, Phi Debian wrote: > In a nutshell to implement a function autoloading I want to plug into > command_not_found_handle(), but I need command_not_found_handle()be > evaluated in the shell context, not in a subshell. OK, so this is not an appropriate feature for what you want to d

Re: command_not_found_handle() flaw

2020-03-10 Thread Greg Wooledge
On Tue, Mar 10, 2020 at 06:37:24PM +0100, Phi Debian wrote: > In a nutshell to implement a function autoloading I want to plug into > command_not_found_handle(), but I need command_not_found_handle()be > evaluated in the shell context, not in a subshell. You can't. Bash has already forked the sub

Patch: command_not_found_handle() flaw

2020-03-10 Thread Phi Debian
diff --git a/execute_cmd.c b/execute_cmd.c index 3864986d..ef32631a 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -5370,6 +5370,20 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out, command = search_for_command (pathname, CMDSRCH_HASH|(stdpath ? CMDSRCH_STDPATH : 0)

command_not_found_handle() flaw

2020-03-10 Thread Phi Debian
Hi All, While trying to implement an function autoload feature, with a lazier function loading and invocation than the example provided in bash doc, I bumped into this bash bug (or feature, you let me know). I asked stackoverflow for some ideas, one pointed me to command_not_found_handle() that