[Top][All Lists]

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

Re: Misleading error when attempting to run foreign executable

From: Chet Ramey
Subject: Re: Misleading error when attempting to run foreign executable
Date: Mon, 11 Oct 2021 11:00:54 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:91.0) Gecko/20100101 Thunderbird/91.2.0

On 10/11/21 7:09 AM, Robert Elz wrote:
>     Date:        Sun, 10 Oct 2021 21:09:53 -0400
>     From:        Eli Schwartz <eschwartz@archlinux.org>
>     Message-ID:  <4a362385-066d-0795-9a02-ff8bbb92007f@archlinux.org>
>   | 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    chet@case.edu    http://tiswww.cwru.edu/~chet/

reply via email to

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