Bug in #! processing
Sławek Żak
szak at era.pl
Thu Sep 30 06:16:24 PDT 2004
"David G. Lawrence" <dg at dglawrence.com> writes:
>> What circular reference? Could you elaborate? The algorithm goes like this:
>>
>> 1. skip all space till #!
>
> The #! is required to be in the first two bytes of the file, so there
> can't be any spaces before it.
Oh. Thus in following script:
thirst<zaks>(1950)% cat tst.sh
#!/bin/no-such-file
ps -lp $$
Which generates following output.
thirst<zaks>(1949)% ./tst.sh /tmp
UID PID PPID CPU PRI NI VSZ RSS MWCHAN STAT TT TIME COMMAND
1001 31645 31278 0 8 0 1636 1024 wait S+ p5 0:00.00 sh ./tst.sh
the interpreter is assumed to be /bin/sh. That's fine with me.
> I wrote the code you guys are talking about, although I had nothing to do
> with the commit in rev 1.21. I don't have an opinion on that other than
> it's been this way in FreeBSD for a long time and I share Ceri's concern
> that changing it will affect some people.
By no means I wish to force anyone to fix their scripts for 5.3
release. Period. I would only like to use Allegro CL in scripts, which
unfortunately considers -#! valid in argument list and acts accordingly on
all platforms besides FreeBSD. Some (in)compatibility shim would be
great. Please! :)
/S
--
Sławek Żak : UNIX Systems Administrator : PTC Sp. zoo
More information about the freebsd-current
mailing list