cvs commit: src/sys/kern imgact_shell.c

Garance A Drosehn gad at FreeBSD.org
Sat May 28 15:57:17 PDT 2005


At 10:42 PM +0000 5/28/05, Garance A Drosehn wrote:
>gad         2005-05-28 22:42:41 UTC
>
>   FreeBSD src repository
>
>   Modified files:
>     sys/kern             imgact_shell.c
>   Log:
>   Change the way options are parsed on the `#!'-line of a shell-script.
>   Instead of having the kernel parse that line and add an entry to the
>   argument list for each 'separate word' it finds, have it add only one
>   entry which holds all the words found on that line.  The old behavior
>   is useful in some situations, but it does not match the way any other
>   operating system will parse that line.

In case it is not obvious from that description, note that this is
an incompatible change.  However, it is expected that this change
should not effect too many scripts.  Also, there was  a recent
commit (v1.23) to bin/sh/options.c which should address the problem
that was most likely to come up due to this change.

For some examples of what kinds of breakage this change might cause,
please check:  http://people.freebsd.org/~gad/Updating-20050528.txt

It is not documented, but this change also provides a TEMPORARY way
to side-step this change, if you have some specific script where you
need immediate fix.

If you start the script with:  #!#<
              instead of just:  #!
(followed by the interpreter name, such as /bin/sh), then that script
will be processed exactly the same way it was processed before this
change.  Note that I expect to delete that option before very long,
unless someone speaks up with some alternate way that this should be
done.  So, don't just use this trick to fix some script and then
forget about the larger issue.  Discuss it on freebsd-arch.

-- 
Garance Alistair Drosehn     =      gad at gilead.netel.rpi.edu
Senior Systems Programmer               or   gad at FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA


More information about the cvs-src mailing list