Skip to contentSkip to conversation

execve() returns ENOENT when ld-linux.so isn't found

DISCUSSION Olaf van der Spek 2 participants 5 messages Mar 18, 2010 – Mar 24, 2010

lore
Share & tools
lore
#0 lore raw

Hi,

When you try to execute an x86 binary on a x64 system, execve() returns ENOENT when ld-linux.so isn't found
Wouldn't ENOEXEC be more appropriate?

Quoted 1 line

An executable is not in a recognized format, is for the wrong architecture, or has some other format error that means it cannot be executed.

This just doesn't make any sense:

$ ls -l
-rwxr-xr-x 1 olaf olaf 560165 2010-03-18 15:21 xwis
$ ./xwis
-bash: ./xwis: No such file or directory

Olaf

#1 lore raw
Quoted 6 lines · Olaf van der Spek

Hi,

When you try to execute an x86 binary on a x64 system, execve() returns ENOENT when ld-linux.so isn't found
Wouldn't ENOEXEC be more appropriate?

Quoted 8 lines
Quoted 1 line

An executable is not in a recognized format, is for the wrong architecture, or has some other format error that means it cannot be executed.

This just doesn't make any sense:

$ ls -l
-rwxr-xr-x 1 olaf olaf 560165 2010-03-18 15:21 xwis
$ ./xwis
-bash: ./xwis: No such file or directory

This is the right list, isn't it?

Olaf

#2 lore raw
In reply to Olaf van der Spek
Quoted 4 lines · Olaf van der Spek
$ ls -l
-rwxr-xr-x 1 olaf olaf 560165 2010-03-18 15:21 xwis
$ ./xwis
-bash: ./xwis: No such file or directory

Your shell should handle this. I'm not sure whether it's in the upstream bash (it should be) but I wrote a long, long time ago a patch which produces better messages. On my system I get:

$ ./u
bash: ./u: /some/path/does-not-exist: bad ELF interpreter: No such file or directory

It doesn't really matter what the kernel returns. The shell should do its job and at least the RHEL/Fedora version does it for a long time now.

#3 lore raw
Quoted 9 lines · On Wed, Mar 24, 2010 at 2:49 PM, <[email protected]> wrote:
Quoted 5 lines · Olaf van der Spek
$ ls -l
-rwxr-xr-x 1 olaf olaf 560165 2010-03-18 15:21 xwis
$ ./xwis
-bash: ./xwis: No such file or directory

Your shell should handle this.  I'm not sure whether it's in the upstream

Why?
And why can't the kernel returned the more appropriate ENOEXEC?

Quoted 10 lines

bash (it should be) but I wrote a long, long time ago a patch which produces better messages.  On my system I get:

$ ./u
bash: ./u: /some/path/does-not-exist: bad ELF interpreter: No such file or
directory

It doesn't really matter what the kernel returns.  The shell should do its job and at least the RHEL/Fedora version does it for a long time now.

That should be pushed upstream then.

Olaf