Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Sep 2004 20:48:53 +0100
From:      Ceri Davies <ceri@submonkey.net>
To:        S?awek ?ak <zaks@prioris.mini.pw.edu.pl>
Cc:        freebsd-current@freebsd.org
Subject:   Re: Bug in #! processing
Message-ID:  <20040928194853.GT2493@submonkey.net>
In-Reply-To: <861xgm5ltz.fsf@thirst.unx.era.pl>
References:  <861xgm5ltz.fsf@thirst.unx.era.pl>

next in thread | previous in thread | raw e-mail | index | archive | help

--KbRlJ7rsgYPVCYDX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Sep 28, 2004 at 07:45:28PM +0200, S?awek ?ak wrote:
> Hi,
>=20
>     It seems that there is a long standing bug in processing of command-l=
ine
>     options for scripts and such. Take following files:
>=20
> [main.c]   =20
> #include <stdio.h>
>=20
> int main(int ac, char **av)
> {
>     int i;
>     printf("Main.c test\n");
>     for(i =3D 0; i < ac; i++) {
>         printf("%s\n", av[i]);
>     }
> }
>=20
> [tst.sh]
> #!./main -#!
> print ok
>=20
>     On FreeBSD 5.x:
>    =20
> thirst<zaks>(1790)% ./tst.sh
> Main.c test
> ./main
> -
> ./tst.sh
>=20
>     On Solaris:
>=20
> sb8:root> ./tst.sh
> Main.c test
> ./main
> -#!
> ./tst.sh
>=20
> 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
=2E/main
-f
-o
-
=2E/tst.sh

	Solaris 9:

$ ./tst.sh
Main.c test
=2E/main
-f
=2E/tst.sh

Now which behaviour do you want?

Ceri
--=20
It is not tinfoil, it is my new skin.  I am a robot.

--KbRlJ7rsgYPVCYDX
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)

iD8DBQFBWcAlocfcwTS3JF8RAm3WAKCjAo+EU05Izm6rEms1p7pMl/9HggCfWm8o
09eK+NN1yt+XQhm8IrXxd9s=
=JISu
-----END PGP SIGNATURE-----

--KbRlJ7rsgYPVCYDX--



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