From: Olaf van der Spek on
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?

> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Olaf van der Spek on
On Thu, Mar 18, 2010 at 3:42 PM, Olaf van der Spek <olafvdspek(a)gmail.com> wrote:
> 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?
>
>> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: drepper on
On Thu, Mar 18, 2010 at 07:42, Olaf van der Spek <olafvdspek(a)gmail.com> wrote:
> $ 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.
From: Olaf van der Spek on
On Wed, Mar 24, 2010 at 2:49 PM, <drepper(a)gmail.com> wrote:
> On Thu, Mar 18, 2010 at 07:42, Olaf van der Spek <olafvdspek(a)gmail.com>
> wrote:
>>
>> $ 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?

> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: drepper on
On Wed, Mar 24, 2010 at 15:37, Olaf van der Spek <olafvdspek(a)gmail.com> wrote:
> Why not?
> It's an improvement IMO, although it could be better.

It's blatantly wrong. There is no dynamic linker. ENOEXEC means the file exists but is not of the right format.