Bug in #! processing - One More Time
Garance A Drosehn
gad at FreeBSD.org
Sun May 15 19:21:22 PDT 2005
At 4:53 AM -0400 5/15/05, Garance A Drosehn wrote:
>... you might try the following shell script:
> #!/usr/bin/env BLAH=aBc BLAH2=OtheR /bin/sh
> echo $BLAH $BLAH2
>Assuming your change to works about the same as mine, that script
>should be an infinite loop.
Well, this behavior is the same as what the user would see with
the same script on other OS's. I could add an option to `env'
which script-writers could use to avoid this problem, but I'm not
sure it's worth the trouble...
>It also looks like something goes wrong with /bin/sh when options
>are given on the #!-line, which may be left-over from my previous
>change to it. I haven't tracked that down yet, but I want to
>understand that before committing the fix we want.
Well, `sh' is probably doing the right thing, but the end result
still breaks the `#!'-trick which is documented in some books on
perl and ruby (and python?). So I want to commit a fix to `sh'
which will allow that trick to work, and then I'll commit the
change to imgact_shell.c that I wrote up. Probably commit an
entry to UPDATING at the same time, since the change could
possibly break some people's scripts. Not likely, but possible...
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 freebsd-arch