Re: execve for script don't return ENOEXEC, bug ?

From: David Newall
Date: Sat Mar 20 2010 - 05:42:11 EST


Valery Reznic wrote:
[valery@localhost ~]$ cat a.sh #!/bin/sh
echo "It's a.sh"
[valery@localhost ~]$ cat b.sh #! ./a.sh
echo "It's b.sh"
[valery@localhost ~]$ [valery@localhost ~]$ strace -f -e execve setarch i386 ./b.sh execve("/usr/bin/setarch", ["setarch", "i386", "./b.sh"], [/* 40 vars */]) = 0
execve("./b.sh", ["./b.sh"], [/* 40 vars */]) = 0
It's a.sh

That is the correct output for a script which is being interpreted by a.sh, when a.sh prints "It's a.sh" using /bin/sh as its interpreter. Remember, you didn't ask /bin/sh to interpret b.sh, you asked a.sh to do it, and a.sh is a simple echo statement, not an interpreter. There is no error here.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/