bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: command_not_found_handle not called if "command" includes a slash


From: Ken Irving
Subject: Re: command_not_found_handle not called if "command" includes a slash
Date: Mon, 28 Dec 2009 15:24:33 -0900
User-agent: Mutt/1.5.20 (2009-06-14)

On Sat, Dec 26, 2009 at 12:54:47PM -0900, Ken Irving wrote:
> Description:
>     I'm not sure this is a bug, but I notice that the
>     command_not_found_handle function is not called if the "command" has a
>     slash in it.  I can't find anywhere in the bash source producing the
>     "No such file ..."  error message, so I guess this is being caught
>     somewhere else before bash gets the command line to process.

Fix:

    This patch is not sufficient, as it leaves the error message, but it
    does call the hook function in the problem cases:

    $ diff -u execute_cmd.c{-original,}
    --- execute_cmd.c-original      2009-12-28 14:48:46.000000000 -0900
    +++ execute_cmd.c       2009-12-28 15:13:22.000000000 -0900
    @@ -4463,7 +4463,17 @@
             leave it there, in the same format that the user used to
             type it in. */
           args = strvec_from_word_list (words, 0, 0, (int *)NULL);
    -      exit (shell_execve (command, args, export_env));
    +      int execve_result;
    +      execve_result = shell_execve (command, args, export_env);
    +      if ( execve_result == 127 )
    +       {
    +         hookf = find_function (NOTFOUND_HOOK);
    +         if (hookf == 0)
    +             exit (execve_result);
    +         wl = make_word_list (make_word (NOTFOUND_HOOK), words);
    +         exit (execute_shell_function (hookf, wl));
    +       }
    +      exit (execve_result);
         }
       else
         {

Ken

-- 
Ken.Irving@alaska.edu




reply via email to

[Prev in Thread] Current Thread [Next in Thread]