bug-bash
[Top][All Lists]
Advanced

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

Re: feature request: file_not_found_handle()


From: Ken Irving
Subject: Re: feature request: file_not_found_handle()
Date: Sun, 18 Aug 2013 19:59:04 -0800
User-agent: Mutt/1.5.20 (2009-06-14)

On Sun, Aug 18, 2013 at 06:30:47PM -0700, Linda Walsh wrote:
> 
> Chet Ramey wrote:
> >On 8/14/13 7:44 AM, Andreas Gregor Frank wrote:
> >>Hi,
> >>
> >>i think a file_not_found_handle() or a modified command_not_found_handle(),
> >>that does not need an unsuccessful PATH search to be triggered, would be
> >>useful and consistent.
> >
> >The original rationale for command_not_found_handle is that there was no
> >other way to determine whether a command could be found with a PATH search.
> >(well, no easy way).
> >
> >A PATH search is suppressed when the command to be executed contains a
> >slash: the presence of a slash indicates an absolute pathname that is
> >directly passed to exec().  Since there's no search done, you know exactly
> >which pathname you're attempting to execute, and you can easily test
> >whether or not it exists and is executable.
> ---
> 
>       How does "lib/font/fontname.ttf" indicate an absolute path?

It's not a question of absolute or relative in that sense, but just
whether it looks like a path of any sort due to the slash.   The context
is for the first entry on a command line, and there's no point in
searching PATH if the value has a slash.  Absolute or relative path makes
no difference.  I suppose you could say that it's abolutely a path...


> This reminds me of a the "dot" (source) command discussion but a bit
> reversed?,  Where it uses the presence of any '/' to force a PATH
> relative search as the first action.
> 
> So if '/' is in a "dot" path, that means it searches path for the file,
> but if it doesn't contain a "/" then it only looks in the CWD??
> 
> What if it starts with a "/"... does that override the PATH search?

It might sound similar but I don't think there's much relation between
this case, where we are dealing with the command to be executed, and the
source command and how it handles its arguments.

We want the attempted command, e.g., lib/font/fontname.ttf, once it fails
bash's attempts to execute it, to be passed to an alternative shell so it
can have a go.  In my system the handler would try to resolve 
lib/font/fontname as an object and ttf as a method, or maybe 
lib/font/fontname.ttf as the object and 'default' as the method.

Ken



reply via email to

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