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

From: Jamie Lokier
Date: Mon Feb 23 2004 - 09:24:09 EST


Paul Jackson wrote:
> > I believe the question was "which shell expects the name in argv[2]
>
> The question is more like: examine each shell's argument parsing code to
> determine which ones will or will not be affected by this. For a change
> like this, someone needs to actually look at the code for each major
> shell, and verify their reading of the code with a little experimentation.

Eh? We do know what the major shells do: They either look at the
first non-option argument for the script name, or they do not accept
options at all.

Anyway that's irrelevant: the splitting change only affects shell
_scripts_ which already have multiple options on the #! line, and
which depend on a space not splitting the argument. If a script
doesn't have that, the shell's behaviour isn't affected by this
change.

Such scripts are non-portable because that behaviour isn't universal
(although I have a feeling the current Linux behaviour was done to
mimick some existing system - as it was never hard to implement
argument splitting of the original author had wanted to.)

In other words, what's relevant is which shell _scripts_ would be
affected, not which shells.

To find those scripts, do:

find /bin /sbin /usr/bin /usr/sbin /usr/X11R6/bin /usr/local/bin \
/etc /usr/lib -type f \
| xargs perl -ne 'print "$ARGV\n" if /^#! ?.+ .+ /; close ARGV'

(Or choose your own directories).

I didn't find any on my system.

-- Jamie
-
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/