From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26756 invoked by alias); 13 Feb 2002 14:52:01 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Received: (qmail 26665 invoked from network); 13 Feb 2002 14:51:59 -0000 Received: from unknown (HELO crt0.crt.umontreal.ca) (132.204.100.27) by sources.redhat.com with SMTP; 13 Feb 2002 14:51:59 -0000 Received: from montreal.crt.umontreal.ca (montreal.crt.umontreal.ca [10.100.1.88]) by crt0.crt.umontreal.ca (8.12.1/8.12.1) with ESMTP id g1DEodrv023560; Wed, 13 Feb 2002 09:50:39 -0500 (EST) Received: (from benoitr@localhost) by montreal.crt.umontreal.ca (8.12.0/8.12.0) id g1DEodCX004623; Wed, 13 Feb 2002 09:50:39 -0500 (EST) From: Benoit Rochefort MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Message-ID: <15466.32063.124480.260990@montreal.crt.umontreal.ca> Date: Wed, 13 Feb 2002 06:52:00 -0000 To: "Gerald S. Williams" Cc: , "David Gluss" , "Peter J. Acklam" Subject: RE: /usr/bin/env - Incorrect parsing of #! line? In-Reply-To: References: <00b901c1b43b$ea06d130$6600a8c0@cherry> X-Mailer: VM 6.72 under 21.1 (patch 8) "Bryce Canyon" XEmacs Lucid X-Face: C!5Mk_!qB]35}VpD|H>GN/@fk%~7:*/x8&~\]|r|)/zV?rJ){uX4Nh`a$L/z__Kx4Gt!mDU 3kZlj)F2]Ds$?l';SO9]v^|[i2nY`pZ+mu+HT%5ITkuP#e]@8F4@Hc.=]oN1+d\M@Rl>-$C?h$yntf -JVx)3L2}VzG.!bQEy]~I_3fup`HtZ^t/Iz.|Vh$~o`^g\ X-SW-Source: 2002-02/txt/msg00657.txt.bz2 My contribution is running the above script on a HPUX-10.20, so you may take a better decision: #!/usr/bin/env perl -v This gives: No such file or directory: perl -v On Solaris2, this gives: This is perl, v5.6.0 built for sun4-solaris ... On Linux: /usr/bin/env: perl -v: No such file or directory On cygwin: /usr/bin/env: perl -v: No such file or directory So that only works fine on Solaris. I really don't know if there is a good reason to scramble all arguments into one, and what's the story behind... A remember that we were limited to 32 (or 31?) characters onto this line some years ago :-) without advertising so it was happening that only on character in the switch was missing for the interpreter (try to debug that!) Gerald S. Williams writes: ] I think DG's and PJA's original assessment was correct and ] BASH should be modified. Support for cross-platform scripts ] is important, and the #!/bin/env trick is used frequently. ]=20 ] It is also not limited to env--any time you use multiple ] arguments to #! you get into trouble. For example, the ] following fails: ]=20 ] #!/bin/python -tt -x ] print "hello, world" ]=20 ] To avoid this, the scripting program would have to take ] special measures to split arguments containing spaces ] into multiple arguments. Perl does this, but defeating ] the shell's argument parser like this has got to be ] dangerous and no doubt involves some degree of magic. ] And as we've seen, that still doesn't help if you're ] using env to find perl. ]=20 ] Solaris (System V) systems don't combine #! arguments ] that way. I don't currently have access to any, but from ] what I can recall, I'm pretty sure that SunOS (BSD) and ] the various flavors of HP and VAX UNIXes all work like ] Solaris in this regard. ]=20 ] Ironically, this difference affects portability between ] Linux/Cygwin and traditional UNIX systems, but doesn't ] affect Windoze compatibility since only the extensions ] matter there and #! is ignored. ]=20 ] I have also seen examples in popular Unix books (such ] as the O'Reilly nutshell books) that rely on multiple ] arguments. ]=20 ] -Jerry ]=20 ] -O Gerald S. Williams, 22Y-103GA : mailto:gsw@agere.com O- ] -O AGERE SYSTEMS, 555 UNION BLVD : office:610-712-8661 O- ] -O ALLENTOWN, PA, USA 18109-3286 : mobile:908-672-7592 O- ]=20 ] Christopher Faylor wrote: ] > > I think you're misinterpreting the problem. If it works the same way ] > > on linux and on cygwin, then there is nothing to fix. ]=20 ] David Gluss wrote: ] > Hmm. You're right about that. In that case I will do nothing. ] > Of course I've always objected to that behavior...but so it is. ]=20 ]=20 ] -- ] Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple ] Bug reporting: http://cygwin.com/bugs.html ] Documentation: http://cygwin.com/docs.html ] FAQ: http://cygwin.com/faq/ --=20 *=BA=A4., =B8=B8,.=A4=BA*=A8=A8=A8*=A4 Benoit Rochefort *=BA= =A4., =B8=B8,.=A4=BA*=A8=A8=A8*=A4 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/