public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* execve for script don't return ENOEXEC, bug ?
@ 2010-03-11 10:56 Valery Reznic
  2010-03-19 21:07 ` Andrew Morton
  0 siblings, 1 reply; 9+ messages in thread
From: Valery Reznic @ 2010-03-11 10:56 UTC (permalink / raw)
  To: linux-kernel

Hi,

I Have following to scripts:

a.sh
#!/bin/sh
echo "It's a.sh

and b.sh:
#! ./b.sh
echo "It's b.sh"

As per execve man page, script interpreter should not be script itself.
When I run it on my Fedora 8 x86_64 box (with stock kernel, never updated)
under strace I got following:

strace -f -e execve  setarch x86_64  ./b.sh 
execve("/usr/bin/setarch", ["setarch", "x86_64", "./b.sh"], [/* 23 vars */]) = 0
execve("./b.sh", ["./b.sh"], [/* 23 vars */]) = -1 ENOEXEC (Exec format error)
execve("/bin/sh", ["/bin/sh", "./b.sh"], [/* 23 vars */]) = 0
It's b.sh

I.e execve failed as it should

When I run same scripts on Fedora 12 x86_64 box with stock kernel 2.6.31.5-127.fc12.x86_64 I got following:

strace -f -e execve setarch i386  ./b.sh 
execve("/usr/bin/setarch", ["setarch", "i386", "./b.sh"], [/* 41 vars */]) = 0
execve("./b.sh", ["./b.sh"], [/* 41 vars */]) = 0
It's a.sh

I.e execve succeeded, instead of failing with ENOEXEC

Regards,
Valery.

P.S. I am not subscribed to this list, so please CC me






      

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-03-21 19:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-11 10:56 execve for script don't return ENOEXEC, bug ? Valery Reznic
2010-03-19 21:07 ` Andrew Morton
2010-03-20  0:37   ` David Newall
2010-03-20  6:42     ` Valery Reznic
2010-03-20  9:41       ` David Newall
2010-03-20 12:56         ` Valery Reznic
2010-03-20 17:57           ` David Newall
2010-03-21  8:33             ` Valery Reznic
2010-03-21 19:16               ` Johannes Stezenbach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox