[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unfortunate error message for invalid executable
From: |
Dale R. Worley |
Subject: |
Re: Unfortunate error message for invalid executable |
Date: |
Thu, 26 May 2022 22:39:27 -0400 |
Chet Ramey <chet.ramey@case.edu> writes:
> On 5/26/22 2:27 PM, AA via Bug reports for the GNU Bourne Again SHell wrote:
>> 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).
This parallels the annoying Unixism that if you attempt to execute a
file that is marked executable that has a #! interpreter specification,
but the specified interpreter does not exist, the generated error is "No
such file or directory". It would be nice if the kernel generated a
separate errno for "a supporting executable for this executable file
does not exist" but nobody's bothered to do that.
Dale
Re: Unfortunate error message for invalid executable, Kerin Millar, 2022/05/26