Linux #! incompatibility?

David Relson relson at osagesoftware.com
Wed Dec 4 19:30:40 CET 2002


At 01:21 PM 12/4/02, Matthias Andree wrote:

>David Relson <relson at osagesoftware.com> writes:
>
> > Attached is a tarball with output from my 3 Mandrake 8.2/9.0 machines
> > running 2.4.18-6mdk (stock & custom kernels) and 2.4.19-16mdk (stock).
> >
> > Given the "invalid option ... GNU long option" message, isn't this more
> > likely a /bin/sh issue, rather than a kernel issue?
>
>Not here, looking at the kernel source, it splits out the interpreter
>field (/bin/sh) and passes the rest of the line as single opaque
>argument to the interpreter, so if I write
>
>#!/bin/sh -- blah
>
>the kernel does the equivalent of
>
>{
>         char *argv[3];
>         argv[0] = "/bin/sh";
>         argv[1] = "-- blah";
>         argv[2] = 0;
>         execve(argv[0], argv, environ);
>         /* error handling here */
>}

I thought the "#!" interpretation done in the shell.  Now I know that it's 
the kernel that interprets the pound-bang of an executable.  Interesting :-)





More information about the bogofilter-dev mailing list