Re: No "cannot execute binary file" for x86 binaries?
On 8 Jun 2004, Matthew Wilcox <willy@debian.org> wrote:
> On Fri, Jun 04, 2004 at 01:59:19PM -0600, Bob Proulx wrote:
> > On an ia64 machine running Bdale's ia64 kernel build of linux 2.4.19
> > and bash 2.05b-2woody3:
> >
> > $ ./hppa/executable ; echo $?
> > -bash: ./hppa/executable: cannot execute binary file
> > 126
> >
> > All well and good and expected. But the following is different:
> >
> > $ ./ia32/executable ; echo $?
> > 127
> >
> > There is no message. Shouldn't this produce a similar error to the
> > one above? Note that I do not have an emulation layer installed.
>
> Right, but I bet you have CONFIG_IA32_SUPPORT turned on. So the code
> path is rather different (see fs/exec.c:search_binary_handler()). For
> the PA code, you're getting -ENOEXEC back. For the x86 code, this is
> a simple matter of not finding the dynamic loader / libs required for
> this executable. I don't know why bash isn't printing an error message
> for this case -- possibly stracing might help?
strace on RHEL3 with /emul blocked off shows
$ strace ./hello
execve("./hello", ["./hello"], [/* 22 vars */]) = 0
strace: exec: No such file or directory
This is the path in bash-2.05b
/* Execve expects the command name to be in args[0]. So we
leave it there, in the same format that the user used to
type it in. */
args = strvec_from_word_list (words, 0, 0, (int *)NULL);
exit (shell_execve (command, args, export_env));
shell_execve ought to print a message for this case. I am not sure
why it doesn't. In some cases there is a useful error:
$ sh -c ./hello
sh: line 1: ./hello: No such file or directory
$ echo $?
127
but this is strange
$ sh -x -c ./hello
+ ./hello
$ echo $?
127
--
Martin
Reply to: