I agree with Ilkka and Alex: it would be helpful to show a different error message in this case.
I know about ELF format and what leads to this, and it's still slightly confusing when faced to it. You have to double-check that the file is indeed there (not a mistyped command), and then locate the right readelf incantation to find the requested interpreter and see that, yes, it happens to not to be available on this host. Looking at the code, it doesn't even need an extra stat(), it already knows the file exists and only providing a different the error message is needed. I'm attaching such patch against devel. Best regards
diff --git a/execute_cmd.c b/execute_cmd.c index 782ae678..0d3e8979 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -5992,8 +5992,20 @@ shell_execve (command, args, env) return (EX_NOEXEC); } #endif - errno = i; - file_error (command); + if (i == ENOENT) + { + /* execve returned ENOENT, but since executable_file() + returned non-zero, we know the file actually exists. + It probably requests an ELF interpreter which is missing. + Provide a helpful message noting that the program is + actually there. */ + internal_error (_("%s: execve failed with `%s' albeit program exists. Needs a missing ELF interpreter?"), command, strerror (ENOENT)); + } + else + { + errno = i; + file_error (command); + } } return (last_command_exit_value); }