From owner-freebsd-current@FreeBSD.ORG Tue Sep 28 19:48:55 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 58ED016A4CE for ; Tue, 28 Sep 2004 19:48:55 +0000 (GMT) Received: from shrike.submonkey.net (cpc2-cdif3-6-0-cust204.cdif.cable.ntl.com [81.103.67.204]) by mx1.FreeBSD.org (Postfix) with ESMTP id 02CC343D48 for ; Tue, 28 Sep 2004 19:48:55 +0000 (GMT) (envelope-from setantae@submonkey.net) Received: from setantae by shrike.submonkey.net with local (Exim 4.42 (FreeBSD)) id 1CCNy1-0009ML-Vf; Tue, 28 Sep 2004 20:48:53 +0100 Date: Tue, 28 Sep 2004 20:48:53 +0100 From: Ceri Davies To: S?awek ?ak Message-ID: <20040928194853.GT2493@submonkey.net> Mail-Followup-To: Ceri Davies , S?awek ?ak , freebsd-current@freebsd.org References: <861xgm5ltz.fsf@thirst.unx.era.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KbRlJ7rsgYPVCYDX" Content-Disposition: inline In-Reply-To: <861xgm5ltz.fsf@thirst.unx.era.pl> X-PGP: finger ceri@FreeBSD.org User-Agent: Mutt/1.5.6i Sender: Ceri Davies cc: freebsd-current@freebsd.org Subject: Re: Bug in #! processing X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2004 19:48:55 -0000 --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 >=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(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--