On 10/11/21 7:09 AM, Robert Elz wrote:
> Date: Sun, 10 Oct 2021 21:09:53 -0400
> From: Eli Schwartz <[email protected]>
> Message-ID: <[email protected]>
>
> | So I wonder, if bash already in this exact case attempts to open() the
> | file and read() it to look for a shebang, what's the harm in assuming
> | (or checking) that it exists in this patch?
>
> This is clearly an OS problem, not one in bash.
This is true. And yet:
> POSIX says of ENOENT as it applies to the exec*() set of functions:
>
> [ENOENT] A component of path or file does not name an existing file
> or path or file is an empty string.
When execve returns this error for what is a clearly invalid reason, it's
not unreasonable that the shell help. It's a quality of implementation
issue at that point. If execve ever returns a different error for this
situation, the 5 lines of code will no longer be needed.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/