bug-bash
[Top][All Lists]
Advanced

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

Re: Unfortunate error message for invalid executable


From: Chet Ramey
Subject: Re: Unfortunate error message for invalid executable
Date: Thu, 26 May 2022 16:42:48 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.0

On 5/26/22 2:27 PM, AA via Bug reports for the GNU Bourne Again SHell wrote:

Bash Version: 5.0
Patch Level: 17
Release Status: release

Description:
         When a user attempts to execute an executable that is not recognized as an executable by the system, the generated error is "No such file or directory"

In this case, it's the errno value returned from execve(2), and it's
exactly correct, at least from the kernel's perspective.

It's not that the executable isn't recognized or in an invalid format, in
which case execve would return ENOEXEC. It's that the ELF header specifies
a particular interpreter to run on the file (e.g., ld.so), and that file is
the one that is not found (ENOENT).

Bash looks at the errno value a bit, but doesn't attempt to second-guess
the kernel to any great extent.

--
``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]