Bug in #! processing
Ceri Davies
ceri at submonkey.net
Tue Sep 28 12:48:55 PDT 2004
On Tue, Sep 28, 2004 at 07:45:28PM +0200, S?awek ?ak wrote:
> Hi,
>
> It seems that there is a long standing bug in processing of command-line
> options for scripts and such. Take following files:
>
> [main.c]
> #include <stdio.h>
>
> int main(int ac, char **av)
> {
> int i;
> printf("Main.c test\n");
> for(i = 0; i < ac; i++) {
> printf("%s\n", av[i]);
> }
> }
>
> [tst.sh]
> #!./main -#!
> print ok
>
> On FreeBSD 5.x:
>
> thirst<zaks>(1790)% ./tst.sh
> Main.c test
> ./main
> -
> ./tst.sh
>
> On Solaris:
>
> sb8:root> ./tst.sh
> Main.c test
> ./main
> -#!
> ./tst.sh
>
> sb8:root> uname -a
> SunOS sb8 5.8 Generic_108528-21 sun4u sparc SUNW,UltraAX-i2
[snip Tru64 and AIX]
> Any takers?
It's easy enough to fix this case, but Solaris looks buggy in other
areas (I do not have any other systems to hand):
FreeBSD 4.10-STABLE:
$ cat tst.sh
#!./main -f -o -#!
print ok
$ ./tst.sh
Main.c test
./main
-f
-o
-
./tst.sh
Solaris 9:
$ ./tst.sh
Main.c test
./main
-f
./tst.sh
Now which behaviour do you want?
Ceri
--
It is not tinfoil, it is my new skin. I am a robot.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20040928/56ac15e9/attachment.bin
More information about the freebsd-current
mailing list