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: Linda Walsh
Subject: Re: feature request: file_not_found_handle()
Date: Sun, 18 Aug 2013 18:30:47 -0700
User-agent: Thunderbird



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?

        The standard interpretation for that would be a relative
path from the CWD.   Only if a path begins with "/" would a path
normally be interpreted as absolute.

        Are you saying bash behaves differently from nearly every
other application in this regard?

        This is only in non-POSIX mode?  (as POSIX specifies that a path
not starting with '/' is to to be taken as relative from the current
directory (under Pathname Resolution: "If the pathname does not
 begin with a slash,...such pathnames are 'relative pathnames'..." --
meaning the CWD of the process is to be prepended).


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?











reply via email to

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