Closed floppym closed 7 years ago
An alternative to this would be to hard-code a fallback PATH setting, probably based on a configure option.
To be honest, I'm not convinced this is the best things to do. Citing POSIX:
If this environment variable is not present, the results of the search are implementation-defined.
This variable certainly isn't POSIX, and the glibc behavior is at best debatable. I certainly don't think it a good idea to use CWD like this.
FreeBSD, Darwin:
If this variable is not specified, the default path is set according to the _PATH_DEFPATH definition in
, which is set to ``/usr/bin:/bin''. For execvP(), the search path is specified as an argument to the function. In addition, certain errors are treated specially.
Solaris manpage doesn't mention fallback at all.
Per our IRC conversation, I will open a new PR with a configure option for this instead.
exec(3) from glibc says:
The execlp(), execvp(), and execvpe() functions duplicate the actions of the shell in searching for an executable file if the specified filename does not contain a slash (/) character. The file is sought in the colon-separated list of directory pathnames specified in the PATH environment variable. If this variable isn't defined, the path list defaults to the current directory followed by the list of directories returned by confstr(_CS_PATH). (This confstr(3) call typically returns the value "/bin:/usr/bin".)