bug-bash
[Top][All Lists]
Advanced

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

Re: error message lacks useful debugging information


From: Chet Ramey
Subject: Re: error message lacks useful debugging information
Date: Thu, 5 Oct 2023 15:23:26 -0400
User-agent: Mozilla Thunderbird

On 10/5/23 2:09 PM, Dave Cigna via Bug reports for the GNU Bourne Again SHell wrote:
I want to thank all of you for taking this issue seriously. I'm sure you all agree that when something fails, the error message should provide useful information about what went wrong.

An error message should accurately convey the information the program
printing it has about an error. So let's look at this case.

Bash attempted to execute a program (./Candle) and received -1/ENOENT
from the kernel. It could have stopped there and printed the corresponding
error message ("No such file or directory"), and, in fact, before October
2021, did just that.

There are several reasons the kernel could have returned this error. The
two most likely are that one of the required shared libraries was missing
or the required ELF interpreter (e.g., ld.so) wasn't present. It was the
latter case that prompted the current wording, from a report in 2021:

https://lists.gnu.org/archive/html/bug-bash/2021-10/msg00020.html

There are other causes, including a missing interpreter specified with #!,
which bash handles separately, but these are the two most common on Linux.

Bash doesn't know which case applies, but both involve missing files that
cause the execve to fail.

I don't think it's appropriate for the shell to be able to look into
executable files of several different formats (e.g., ELF, Mach-O) and
determine which of the several potential cases applies here. That's code
I don't need to carry around or support.

If bash simply doesn't have the information because the kernel didn't provide it, then perhaps I should throw this to the kernel developers.

The kernel is telling you what it knows. Bash is telling you what it knows.
There are other tools (file, ldd, etc.) that can tell you more.

https://lists.gnu.org/archive/html/bug-bash/2021-10/msg00090.html
suggests other values for errno that might be more appropriate, but we
get what we get. The Linux man pages already appropriate ENOENT for these
cases anyway, but there's no good way to determine which file is missing.
And so bash reports that a required file was not found.

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