[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Poor messages when the '#!' file isn't found
From: |
Martin D Kealey |
Subject: |
Re: Poor messages when the '#!' file isn't found |
Date: |
Fri, 14 Jun 2024 13:03:25 +1200 |
On Fri, 14 Jun 2024 at 06:13, Dan Jacobson <jidanni@jidanni.org> wrote:
> ./k
> make: ./k: No such file or directory
>
This is a problem with the POSIX spec for the execve system call and its
obligatory return codes.
"No such file or directory" is arguably the correct message to show when
the kernel returns the ENOENT error code. And *normally* it's appropriate
to attach that to the filename that was passed to the kernel; however in
this case the combination may be confusing.
I would argue that a more appropriate error code would be ENOEXEC ("exec
format error", which is what you get when the kernel lacks an "interpreter"
for ELF or a.out or JAR files) or perhaps a new code such as ENOINTERP.
However, this should be addressed to the POSIX committee, and to the Kernel
developers for Linux, FreeBSD, Windows, and others.
Bash's message is intentionally more vague precisely *because* this is a
known issue.
-Martin