Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 May 2005 22:21:19 -0400
From:      Garance A Drosehn <gad@FreeBSD.org>
To:        Maxim Sobolev <sobomax@FreeBSD.org>
Cc:        freebsd-arch@FreeBSD.org
Subject:   Re: Bug in #! processing - One More Time
Message-ID:  <p06210221beadaebcff16@[128.113.24.47]>
In-Reply-To: <p0621021bbeaca141d590@[128.113.24.47]>
References:  <200410020349.i923nG8v021675@northstar.hetzel.org> <20041002052856.GE17792@nexus.dglawrence.com> <p0611041fbd848f6aa55d@[128.113.24.47]> <20041002233542.GL714@nexus.dglawrence.com> <p0620076ebe2490ccdc00@[128.113.24.47]> <p06210225be4307a39100@[128.113.24.47]> <421DAD8F.6000704@portaone.com> <p0621024bbe482b50f150@[128.113.24.47]> <4284D038.50805@FreeBSD.org> <p0621020dbeaa836cd61a@[128.113.24.47]> <4284D4BC.9070705@FreeBSD.org> <p0621020fbeaa86c39e7d@[128.113.24.47]> <4284ED54.9010603@FreeBSD.org> <p0621021bbeaca141d590@[128.113.24.47]>

next in thread | previous in thread | raw e-mail | index | archive | help
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...

That's at:
http://people.freebsd.org/~gad/imgact_shell.diff
http://people.freebsd.org/~gad/imgact_shell.c

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p06210221beadaebcff16>