Re: [PATCH] Linux 2.6: shebang handling in fs/binfmt_script.c

From: Hansjoerg Lipp
Date: Mon Feb 23 2004 - 20:22:13 EST


On Mon, Feb 23, 2004 at 01:46:10PM -0800, Paul Jackson wrote:
> Andries Brouwer wrote:
> > If there is such nonblank text then for SysVR4,
> > SunOS, Solaris, IRIX, HPUX, AIX, Unixware, Linux, OpenBSD, Tru64
> > this group consists of precisely one argument.
> > FreeBSD, BSD/OS, BSDI split the text
>
> Interesting - I notice that 9 Operating Systems, in addition to Linux,
> don't split the optional shebang argument, and 3 do.

Yes. And this shows, that Linux would not be the first OS which splits
arguments. One more reason, why I'm sure this change won't cause lots of
problems.

> All else equal, I am not enthusiastic about a somewhat arbitrary change
> that could be done either way, that is actually done more often in other
> operating systems the current way, and that potentially affects both
> script files and their interpreters (shells, awk, perl, python, guile,
> tcl, bc, ...).
[...]

As written in my previous mail, it only affects scripts, that already
have multiple arguments in the shebang line. So, I don't see a lot of
problems here.

> And, to be truthful, the usual way that I code awk scripts is not as
> a shbang script with an interpreter of awk,
>
> #!/bin/awk
> BEGIN ...
>
> but rather as a quoted awk script within a shell script:
>
> #!/bin/sh
> awk '
> BEGIN ...
> '
>
[...]

This may be right for awk, although I still consider wrapper scripts to
be somewhat awkward. But your argument is not true for shells, perl,
python, ... And I still think, it's somewhat strange, that perl has to
parse the shebang line of the scripts, because the OS can't do it. And
as other interpreters don't act this way, there are totally unnecessary
restrictions writing certain scripts...

> This is a portable habit, that avoids all the afore mentioned
> limitations and inconsistencies in shbang handling.

If you write scripts for several OSes you are right. On the other hand,
I don't see any reason, why one should stick to the limits of some other
operating systems, when it's not necessary. Acting this way will never
change these limitations. If the three OSes mentioned above _and_ Linux
handle the shebang line in a more sensible way, this could be one step
to get rid of these inconsistencies.

Regards,

Hansjoerg Lipp
-
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/