public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* /usr/bin/env - Incorrect parsing of #! line?
@ 2002-02-12 10:38 Peter J. Acklam
  2002-02-12 10:53 ` Christopher Faylor
                   ` (2 more replies)
  0 siblings, 3 replies; 36+ messages in thread
From: Peter J. Acklam @ 2002-02-12 10:38 UTC (permalink / raw)
  To: cygwin

I use different computers where Perl is installed different
places, so I can't hardcode the location of perl in the shebang
line.  Thus, I use env, which works great on all UNIXes I work on,
for instance

    #!/usr/bin/env perl -w

    print "This is Perl version $]\n";

but on Cygwin I get

    /usr/bin/env: perl -w: No such file or directory

why does Cygwin look for the file "perl -w".  No UNIX I have
worked on would parse the shebang line that way.

Peter

-- 
People say I'm indifferent, but I don't care.


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-12 10:38 /usr/bin/env - Incorrect parsing of #! line? Peter J. Acklam
@ 2002-02-12 10:53 ` Christopher Faylor
  2002-02-12 12:16   ` Peter J. Acklam
  2002-02-12 11:56 ` David Gluss
  2002-02-12 14:57 ` Chris January
  2 siblings, 1 reply; 36+ messages in thread
From: Christopher Faylor @ 2002-02-12 10:53 UTC (permalink / raw)
  To: cygwin

On Tue, Feb 12, 2002 at 07:38:21PM +0100, Peter J. Acklam wrote:
>I use different computers where Perl is installed different
>places, so I can't hardcode the location of perl in the shebang
>line.  Thus, I use env, which works great on all UNIXes I work on,
>for instance
>
>    #!/usr/bin/env perl -w
>
>    print "This is Perl version $]\n";
>
>but on Cygwin I get
>
>    /usr/bin/env: perl -w: No such file or directory
>
>why does Cygwin look for the file "perl -w".  No UNIX I have
>worked on would parse the shebang line that way.

Because...  we're mean.

cgf

--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-12 10:38 /usr/bin/env - Incorrect parsing of #! line? Peter J. Acklam
  2002-02-12 10:53 ` Christopher Faylor
@ 2002-02-12 11:56 ` David Gluss
  2002-02-12 12:17   ` Peter J. Acklam
  2002-02-12 14:57 ` Chris January
  2 siblings, 1 reply; 36+ messages in thread
From: David Gluss @ 2002-02-12 11:56 UTC (permalink / raw)
  To: cygwin, Peter J. Acklam

I don't know if it's constructive to suggest an alternative trick, rather
than trying to fix cygwin, in this forum.  However, this might work
for you:
>------------
>: # -*-Mode: perl;-*- use perl, wherever it is
>eval 'exec perl -wS $0 ${1+"$@"}'
>  if 0;
>#!/usr/local/bin/perl -w
>------------
DG


----- Original Message ----- 
From: "Peter J. Acklam" <pjacklam@online.no>
To: <cygwin@cygwin.com>
Sent: Tuesday, February 12, 2002 10:38 AM
Subject: /usr/bin/env - Incorrect parsing of #! line?


> I use different computers where Perl is installed different
> places, so I can't hardcode the location of perl in the shebang
> line.  Thus, I use env, which works great on all UNIXes I work on,
> for instance
> 
>     #!/usr/bin/env perl -w
> 
>     print "This is Perl version $]\n";
> 
> but on Cygwin I get
> 
>     /usr/bin/env: perl -w: No such file or directory
> 
> why does Cygwin look for the file "perl -w".  No UNIX I have
> worked on would parse the shebang line that way.
> 
> Peter
> 
> -- 
> People say I'm indifferent, but I don't care.
> 
> 
> --
> 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/
> 


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-12 10:53 ` Christopher Faylor
@ 2002-02-12 12:16   ` Peter J. Acklam
  2002-02-12 14:25     ` Charles Wilson
  0 siblings, 1 reply; 36+ messages in thread
From: Peter J. Acklam @ 2002-02-12 12:16 UTC (permalink / raw)
  To: cygwin

Christopher Faylor <cygwin@cygwin.com> wrote:

> Peter J. Acklam wrote:
>
> > [...]
> > why does Cygwin look for the file "perl -w".  No UNIX I
> > have worked on would parse the shebang line that way.
> 
> Because...  we're mean.

I'm new here so I don't know who you are, but I hope one can
expect more informative responses than this gibberish.

Peter

-- 
People say I'm indifferent, but I don't care.


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-12 11:56 ` David Gluss
@ 2002-02-12 12:17   ` Peter J. Acklam
  2002-02-12 13:56     ` David Gluss
  0 siblings, 1 reply; 36+ messages in thread
From: Peter J. Acklam @ 2002-02-12 12:17 UTC (permalink / raw)
  To: David Gluss; +Cc: cygwin, Peter J. Acklam

"David Gluss" <dgluss@marple-tech.com> wrote:

> I don't know if it's constructive to suggest an alternative trick, rather
> than trying to fix cygwin, in this forum.  However, this might work
> for you:
>>------------
>>: # -*-Mode: perl;-*- use perl, wherever it is
>>eval 'exec perl -wS $0 ${1+"$@"}'
>>  if 0;
>>#!/usr/local/bin/perl -w
>>------------

Thanks!  But I wonder, does the colon really belong there?  If so,
what does it do?  Will this work under all common shells (sh, ksh,
bash, zsh, csh, tcsh)?

I hasitate to use a script with no shebang line, because I'm so
used to it always being present in a script, but if I don't really
need it, then I guess I can do without.

Peter

-- 
People say I'm indifferent, but I don't care.


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-12 12:17   ` Peter J. Acklam
@ 2002-02-12 13:56     ` David Gluss
  0 siblings, 0 replies; 36+ messages in thread
From: David Gluss @ 2002-02-12 13:56 UTC (permalink / raw)
  To: Peter J. Acklam; +Cc: cygwin, Peter J. Acklam

I've only tried it with csh, tcsh, sh, and bash.  I put that first line in
with a colon
to put emacs into perl-mode.  It could probably be a # instead...as long as
it's
not #!.
----- Original Message -----
From: "Peter J. Acklam" <pjacklam@online.no>
To: "David Gluss" <dgluss@marple-tech.com>
Cc: <cygwin@cygwin.com>; "Peter J. Acklam" <pjacklam@online.no>
Sent: Tuesday, February 12, 2002 12:15 PM
Subject: Re: /usr/bin/env - Incorrect parsing of #! line?


> "David Gluss" <dgluss@marple-tech.com> wrote:
>
> > I don't know if it's constructive to suggest an alternative trick,
rather
> > than trying to fix cygwin, in this forum.  However, this might work
> > for you:
> >>------------
> >>: # -*-Mode: perl;-*- use perl, wherever it is
> >>eval 'exec perl -wS $0 ${1+"$@"}'
> >>  if 0;
> >>#!/usr/local/bin/perl -w
> >>------------
>
> Thanks!  But I wonder, does the colon really belong there?  If so,
> what does it do?  Will this work under all common shells (sh, ksh,
> bash, zsh, csh, tcsh)?
>
> I hasitate to use a script with no shebang line, because I'm so
> used to it always being present in a script, but if I don't really
> need it, then I guess I can do without.
>
> Peter
>
> --
> People say I'm indifferent, but I don't care.
>
>
> --
> 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/
>


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-12 12:16   ` Peter J. Acklam
@ 2002-02-12 14:25     ` Charles Wilson
  2002-02-12 14:59       ` David Gluss
  2002-02-20 13:03       ` Peter J. Acklam
  0 siblings, 2 replies; 36+ messages in thread
From: Charles Wilson @ 2002-02-12 14:25 UTC (permalink / raw)
  To: Peter J. Acklam; +Cc: cygwin

Peter J. Acklam wrote:

> Christopher Faylor <cygwin@cygwin.com> wrote:
> 
> 
>>Peter J. Acklam wrote:
>>
>>
>>>[...]
>>>why does Cygwin look for the file "perl -w".  No UNIX I
>>>have worked on would parse the shebang line that way.
>>>
>>Because...  we're mean.
>>
> 
> I'm new here so I don't know who you are, but I hope one can
> expect more informative responses than this gibberish.


When Chris says "because we're mean" it *usually* means that the 
original post was either
   a) rude
   b) accusatory
   c) demanding
AND that the original poster made an incorrect analysis of their 
problem, then complained about the non-existant problem, and blamed the 
cygwin developers for being such idiots to make that (non-existant) mistake.

For instance:
-----------BEGIN EXAMPLE-------------
   "When I start cygwin, it complains that there is no /tmp directory. 
But TEMP=C:\WINNT\TEMP, so of course /tmp exists.  Why doesn't cygwin 
understand TEMP?"

Answer: "because we're mean".  cygwin understanding the TEMP environment 
variable has nothing to do with whether a directory named '/tmp' exists. 
  Cygwin DOES in fact understand TEMP -- but not all applications on 
cygwin use TEMP; some, like bash, directly hardcode '/tmp' and complain 
if it doesn't exist.  Furthermore, setup.exe automatically creates /tmp, 
so if it doesn't exist on your machine, then either (a) setup is broken 
-- but the other 2000 people who successfully used it never ran in to 
that problem, or (b) [much more likely] you didn't use setup.exe to 
install cygwin.  Bad bad bad bad.

e.g. You didn't follow the directions on how cygwin should be installed, 
then discovered that stuff doesn't work right, then misanalyzed the 
problem, and blamed us for it.

Because we're mean.
-----------END EXAMPLE-------------

Your question was borderline: "No UNIX I have worked on would parse the 
sheband line that way" This statement as worded implies
1) you are much more experienced with unix than any of the monkeys 
working on cygwin
2) cygwin sucks -- the monkeys must have been lobotomized before they 
started coding it
3) fix it now, you damn lobotomized code monkeys!

Furthermore, it isn't *cygwin* that's parsing the command line.  It's 
env.exe.  AND, it is not NECESSARILY looking for 'perl -w' -- maybe it's 
just reporting all of its arguments, like a good little app.  Perhaps, 
env can't find perl in the current PATH at all -- so it's really just 
saying "can't find "perl" -- and btw, you had a '-w' argument".  There's 
no way to know from what you reported.

But you blamed us, and cygwin, anyway.

Because we're mean.

--Chuck


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-12 10:38 /usr/bin/env - Incorrect parsing of #! line? Peter J. Acklam
  2002-02-12 10:53 ` Christopher Faylor
  2002-02-12 11:56 ` David Gluss
@ 2002-02-12 14:57 ` Chris January
  2002-02-20 12:57   ` Peter J. Acklam
  2 siblings, 1 reply; 36+ messages in thread
From: Chris January @ 2002-02-12 14:57 UTC (permalink / raw)
  To: Peter J. Acklam; +Cc: cygwin

> I use different computers where Perl is installed different
> places, so I can't hardcode the location of perl in the shebang
> line.  Thus, I use env, which works great on all UNIXes I work on,
> for instance
>
>     #!/usr/bin/env perl -w
>
>     print "This is Perl version $]\n";
>
> but on Cygwin I get
>
>     /usr/bin/env: perl -w: No such file or directory
>
> why does Cygwin look for the file "perl -w".  No UNIX I have
> worked on would parse the shebang line that way.
Linux parses things this way too. I don't know what "UNIX"'s this works on.
(Sun, HP?)

Regards
Chris



--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-12 14:25     ` Charles Wilson
@ 2002-02-12 14:59       ` David Gluss
  2002-02-20 13:03       ` Peter J. Acklam
  1 sibling, 0 replies; 36+ messages in thread
From: David Gluss @ 2002-02-12 14:59 UTC (permalink / raw)
  To: Charles Wilson, Peter J. Acklam; +Cc: cygwin

I think it takes a while to get used to the style of this
list.  Thank you for explaining what was meant by
"because... we're mean".
Perhaps a little forgiveness and tolerance all around
would (slap)...oops, never mind...
DG
PS:
% env foobar
env: foobar: No such file or directory
% env foobar -w
env: foobar: No such file or directory
-->put #!/usr/bin/env perl in script "blah"
% blah
% (works fine)
-->put #!/usr/bin/env perl -w in script
% blah
/usr/bin/env: perl -w: No such file or directory
$ echo $SHELL
d:/cygwin/bin/sh.exe

So I believe the original poster (PJA) was correct in his assessment.
It's not "env", because #!/bin/ls gives similar behavior.

----- Original Message -----
From: "Charles Wilson" <cwilson@ece.gatech.edu>
To: "Peter J. Acklam" <pjacklam@online.no>
Cc: <cygwin@cygwin.com>
Sent: Tuesday, February 12, 2002 2:23 PM
Subject: Re: /usr/bin/env - Incorrect parsing of #! line?


> Peter J. Acklam wrote:
>
> > Christopher Faylor <cygwin@cygwin.com> wrote:
> >
> >
> >>Peter J. Acklam wrote:
> >>
> >>
> >>>[...]
> >>>why does Cygwin look for the file "perl -w".  No UNIX I
> >>>have worked on would parse the shebang line that way.
> >>>
> >>Because...  we're mean.
> >>
> >
> > I'm new here so I don't know who you are, but I hope one can
> > expect more informative responses than this gibberish.
>
>
> When Chris says "because we're mean" it *usually* means that the
> original post was either
>    a) rude
>    b) accusatory
>    c) demanding
> AND that the original poster made an incorrect analysis of their
> problem, then complained about the non-existant problem, and blamed the
> cygwin developers for being such idiots to make that (non-existant)
mistake.
>
> For instance:
> -----------BEGIN EXAMPLE-------------
>    "When I start cygwin, it complains that there is no /tmp directory.
> But TEMP=C:\WINNT\TEMP, so of course /tmp exists.  Why doesn't cygwin
> understand TEMP?"
>
> Answer: "because we're mean".  cygwin understanding the TEMP environment
> variable has nothing to do with whether a directory named '/tmp' exists.
>   Cygwin DOES in fact understand TEMP -- but not all applications on
> cygwin use TEMP; some, like bash, directly hardcode '/tmp' and complain
> if it doesn't exist.  Furthermore, setup.exe automatically creates /tmp,
> so if it doesn't exist on your machine, then either (a) setup is broken
> -- but the other 2000 people who successfully used it never ran in to
> that problem, or (b) [much more likely] you didn't use setup.exe to
> install cygwin.  Bad bad bad bad.
>
> e.g. You didn't follow the directions on how cygwin should be installed,
> then discovered that stuff doesn't work right, then misanalyzed the
> problem, and blamed us for it.
>
> Because we're mean.
> -----------END EXAMPLE-------------
>
> Your question was borderline: "No UNIX I have worked on would parse the
> sheband line that way" This statement as worded implies
> 1) you are much more experienced with unix than any of the monkeys
> working on cygwin
> 2) cygwin sucks -- the monkeys must have been lobotomized before they
> started coding it
> 3) fix it now, you damn lobotomized code monkeys!
>
> Furthermore, it isn't *cygwin* that's parsing the command line.  It's
> env.exe.  AND, it is not NECESSARILY looking for 'perl -w' -- maybe it's
> just reporting all of its arguments, like a good little app.  Perhaps,
> env can't find perl in the current PATH at all -- so it's really just
> saying "can't find "perl" -- and btw, you had a '-w' argument".  There's
> no way to know from what you reported.
>
> But you blamed us, and cygwin, anyway.
>
> Because we're mean.
>
> --Chuck
>
>
> --
> 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/
>


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-12 14:57 ` Chris January
@ 2002-02-20 12:57   ` Peter J. Acklam
  0 siblings, 0 replies; 36+ messages in thread
From: Peter J. Acklam @ 2002-02-20 12:57 UTC (permalink / raw)
  To: cygwin

"Chris January" <chris@atomice.net> wrote:

> Peter J. Acklam wrote:
>
> > [...] on Cygwin I get
> >
> >     /usr/bin/env: perl -w: No such file or directory
> >
> > why does Cygwin look for the file "perl -w".  No UNIX I have
> > worked on would parse the shebang line that way.
>
> Linux parses things this way too. I don't know what "UNIX"'s
> this works on.  (Sun, HP?)

I have worked with many UNIXes, but now that I think about it, I
have probably only used the line "#!/usr/bin/env perl -w" on
Solaris.  However, it works on solaris 2.3, 2.5, 7, and 8.

Peter

-- 
People say I'm indifferent, but I don't care.


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-12 14:25     ` Charles Wilson
  2002-02-12 14:59       ` David Gluss
@ 2002-02-20 13:03       ` Peter J. Acklam
  1 sibling, 0 replies; 36+ messages in thread
From: Peter J. Acklam @ 2002-02-20 13:03 UTC (permalink / raw)
  To: cygwin

Charles Wilson <cwilson@ece.gatech.edu> wrote:

> Peter J. Acklam wrote:
> 
> > Christopher Faylor <cygwin@cygwin.com> wrote:
> > 
> > > Peter J. Acklam wrote:
> > > 
> > > > [...]
> > > > why does Cygwin look for the file "perl -w".  No UNIX I
> > > > have worked on would parse the shebang line that way.
> > > > 
> > > Because...  we're mean.
> > > 
> > I'm new here so I don't know who you are, but I hope one can
> > expect more informative responses than this gibberish.
> 
> When Chris says "because we're mean" it *usually* means that the
> original post was either
> a) rude
> b) accusatory
> c) demanding
> AND that the original poster made an incorrect analysis of their
> problem, then complained about the non-existant problem, and
> blamed the cygwin developers for being such idiots to make that
> (non-existant) mistake.

That's fair enough, and common on USENET news groups, but I really
can't see how my posting falls into any of the categories you
mention.  Oh well, no big deal.

Peter

-- 
People say I'm indifferent, but I don't care.


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
@ 2002-02-22  5:26 pjacklam
  0 siblings, 0 replies; 36+ messages in thread
From: pjacklam @ 2002-02-22  5:26 UTC (permalink / raw)
  To: cygwin

> Create a wrapper script, e.g. '/usr/local/bin/perl -w', with
> contents
>
>         #!/bin/sh
>         perl -w $*

Firstly, I would need to do that on every computer I might
run Perl on, which in itself is harly possible.  At the
very least it is rather impractical.

Secondly, I run Perl with many different combinations of
options, like "perl -w", "perl -wn", "perl -0777 -wn", etc.
which makes that approach even far less feasible.

By the way, you did mean "$@" and not $*, didn't you? :-)

Peter

-- 
Peter J. Acklam - pjacklam@online.no - http://home.online.no/~pjacklam


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-22  1:27 pjacklam
@ 2002-02-22  4:34 ` Michael Schaap
  0 siblings, 0 replies; 36+ messages in thread
From: Michael Schaap @ 2002-02-22  4:34 UTC (permalink / raw)
  To: pjacklam, cygwin

At 09:53 22-2-2002, pjacklam wrote:
>I know, but cygwin respects shebang lines (e.g., a text
>file in the path starting with the line "#!/bin/gawk"
>will really be run by gawk), so I'm sure there is a way
>to get this working right.  I just haven't found it yet.

Well, someone(*) posted a solution that should work for you:

Create a wrapper script, e.g. '/usr/local/bin/perl -w', with contents

         #!/bin/sh
         perl -w $*

  - Michael

(*): Sorry, don't remember who suggested this.  And this thread has become 
_way_ too long to find it back...

-- 
     I always wondered about the meaning of life.   So I looked it
     up in the dictionary under "L" and there it was - the meaning
     of life.  It was not what I expected.                  - Dogbert 


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
@ 2002-02-22  1:27 pjacklam
  2002-02-22  4:34 ` Michael Schaap
  0 siblings, 1 reply; 36+ messages in thread
From: pjacklam @ 2002-02-22  1:27 UTC (permalink / raw)
  To: cygwin

hammond@csc.albany.edu (William F. Hammond) writes:

> I don't understand why you want to use /usr/bin/env
> under Cygwin.

The reason is portability.  I have written hundreds of
Perl utilities which I find extremely useful and I
want them to run smoothly both on UNIX and cygwin.
I really hesitate to maintain one set of utilities for
cygwin, one for Solaris, one for HP-UX, etc.

> Not everything that makes sense under *ix makes sense
> for Cygwin.

I know, but cygwin respects shebang lines (e.g., a text
file in the path starting with the line "#!/bin/gawk"
will really be run by gawk), so I'm sure there is a way
to get this working right.  I just haven't found it yet.

> Presumably one runs Cygwin because one does not want
> to run Linux so that one can have simultaneous single
> platform access to Win* things and Gnu things familiar
> in *ix contexts.

Yep.

> That said, doesn't it then make sense to use a straight
> Win* build for perl so that perl can be used in Win*
> mode?

I have tried, and I found out that a Win* build of Perl
doesn't integrate well with cygwin.

> Granted that -- and granted the desire to build
> environment outside of the Perl script itself -- one
> may use either a bat file or an sh script, as appropriate
> for the calling context, to create the needed environment.

True, that works, I have tried, but then I need a whole
set of bat files and sh files in addition to the original
Perl scripts and that's what I am trying to avoid.  :-)

Thanks for your input!

Peter


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-21 12:47       ` Peter J. Acklam
  2002-02-21 13:04         ` Peter J. Acklam
@ 2002-02-21 19:10         ` William F. Hammond
  1 sibling, 0 replies; 36+ messages in thread
From: William F. Hammond @ 2002-02-21 19:10 UTC (permalink / raw)
  To: Peter J. Acklam; +Cc: Larry Hall (RFK Partners, Inc), cygwin

pjacklam@online.no (Peter J. Acklam) writes:

> "Larry Hall (RFK Partners, Inc)" <lhall@rfk.com> wrote:
> 
> > Well if env documentation states a particular behavior and that
> > behavior is not what you see, then there is a bug in env or it's
> > documentation.
> 
> What made me believe that "#!/usr/bin/env perl -w" should work was
> the following part of the documentation for env:

I don't understand why you want to use /usr/bin/env under Cygwin.

Not everything that makes sense under *ix makes sense for Cygwin.

Presumably one runs Cygwin because one does not want to run Linux
so that one can have simultaneous single platform access to Win*
things and Gnu things familiar in *ix contexts.

That said, doesn't it then make sense to use a straight Win* build for
perl so that perl can be used in Win* mode?  Granted that -- and
granted the desire to build environment outside of the Perl script
itself -- one may use either a bat file or an sh script, as
appropriate for the calling context, to create the needed environment.

Either way after building the environment use the syntax:
perl {script-name} {script-arg} ... .

                                    -- Bill

--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-20 21:33     ` Christopher Faylor
@ 2002-02-21 13:23       ` Peter J. Acklam
  0 siblings, 0 replies; 36+ messages in thread
From: Peter J. Acklam @ 2002-02-21 13:23 UTC (permalink / raw)
  To: cygwin

Christopher Faylor <cgf@redhat.com> wrote:

> Peter J. Acklam wrote:

> > Since the behaviour is different when the line is in the
> > shebang line, it has to be documented somewhere.
>
> AFAIK, it isn't documented anywhere except in the code.  I don't
> know where it would be documented, actually.  This obviously
> isn't an issue with /usr/bin/env.

Ok.  I'm not sure either.  I know that Solaris has an intro(1)
manual page which describes general command behaviour, standard
option parsing, etc.  I guess that might be a suitable place, but
cygwin has no such manual page.

> Where did you read about the behavior in "all UNIXes I work on"?
> We should probably document it in a similar place for cygwin.

That turned out to be an incorrect assumption on my part.  I have
worked with many UNIX flavours, and assumed that I had been using
this syntax on all of them, but it turned out to be that I had
only used it on Solaris where this syntax actually works.

> We'd certainly appreciate a patch to our documentation.  Just
> send it to cygwin@cygwin.com for review.

I'm not sure where it really ought to be documented.  :-/

Peter

-- 
People say I'm indifferent, but I don't care.


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-21 12:47       ` Peter J. Acklam
@ 2002-02-21 13:04         ` Peter J. Acklam
  2002-02-21 19:10         ` William F. Hammond
  1 sibling, 0 replies; 36+ messages in thread
From: Peter J. Acklam @ 2002-02-21 13:04 UTC (permalink / raw)
  To: cygwin

"Larry Hall (RFK Partners, Inc)" <lhall@rfk.com> wrote:

> Well if env documentation states a particular behavior and that
> behavior is not what you see, then there is a bug in env or it's
> documentation.

What made me believe that "#!/usr/bin/env perl -w" should work was
the following part of the documentation for env:

   NAME
          env - run a program in a modified environment

   SYNOPSIS
          env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]

It clearly says that the command (COMMAND) takes arguments (ARG).
Indeed it does on the command line, but not on the shebang line.

> You should contact it's maintainer and since it appears to be a
> general issue, you should contact the GNU maintainer, not the
> Cygwin.

I'm not sure what to do, if anything, since this behaviour seems
to be so common.  For all I know, someone might count on it.

Peter

-- 
People say I'm indifferent, but I don't care.


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-20 13:37     ` Larry Hall (RFK Partners, Inc)
@ 2002-02-21 12:47       ` Peter J. Acklam
  2002-02-21 13:04         ` Peter J. Acklam
  2002-02-21 19:10         ` William F. Hammond
  0 siblings, 2 replies; 36+ messages in thread
From: Peter J. Acklam @ 2002-02-21 12:47 UTC (permalink / raw)
  To: Larry Hall (RFK Partners, Inc); +Cc: Peter J. Acklam, cygwin

"Larry Hall (RFK Partners, Inc)" <lhall@rfk.com> wrote:

> Well if env documentation states a particular behavior and that
> behavior is not what you see, then there is a bug in env or it's
> documentation.

What made me believe that "#!/usr/bin/env perl -w" should work was
the following part of the documentation for env:

   NAME
          env - run a program in a modified environment

   SYNOPSIS
          env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]

It clearly says that the command (COMMAND) takes arguments (ARG).
Indeed it does on the command line, but not on the shebang line.

> You should contact it's maintainer and since it appears to be a
> general issue, you should contact the GNU maintainer, not the
> Cygwin.

I'm not sure what to do, if anything, since this behaviour seems
to be so common.  For all I know, someone might count on it.

Peter

-- 
People say I'm indifferent, but I don't care.


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-20 12:57   ` Peter J. Acklam
  2002-02-20 13:37     ` Larry Hall (RFK Partners, Inc)
@ 2002-02-20 21:33     ` Christopher Faylor
  2002-02-21 13:23       ` Peter J. Acklam
  1 sibling, 1 reply; 36+ messages in thread
From: Christopher Faylor @ 2002-02-20 21:33 UTC (permalink / raw)
  To: cygwin

On Wed, Feb 20, 2002 at 09:35:16PM +0100, Peter J. Acklam wrote:
>Christopher Faylor <cgf@redhat.com> wrote:
>>If it works the same way on linux and on cygwin, then there is
>>nothing to fix.
>
>Ok.  But where is this documented?
>
>I expected "#!/usr/bin/env perl -w" to work because I thought the
>line would be interpreted as on the command line (shell) and as is
>documented in the manual page for env.  Since the behaviour is
>different when the line is in the shebang line, it has to be
>documented somewhere.

AFAIK, it isn't documented anywhere except in the code.  I don't
know where it would be documented, actually.  This obviously isn't
an issue with /usr/bin/env.

Where did you read about the behavior in "all UNIXes I work on"?  We
should probably document it in a similar place for cygwin.

We'd certainly appreciate a patch to our documentation.  Just send
it to cygwin@cygwin.com for review.

cgf
--
Please do not send me personal email with cygwin questions.
Use the resources at http://cygwin.com/ .

--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-20 12:57   ` Peter J. Acklam
@ 2002-02-20 13:37     ` Larry Hall (RFK Partners, Inc)
  2002-02-21 12:47       ` Peter J. Acklam
  2002-02-20 21:33     ` Christopher Faylor
  1 sibling, 1 reply; 36+ messages in thread
From: Larry Hall (RFK Partners, Inc) @ 2002-02-20 13:37 UTC (permalink / raw)
  To: Peter J. Acklam, cygwin

At 03:35 PM 2/20/2002, Peter J. Acklam wrote:
>Christopher Faylor <cgf@redhat.com> wrote:
>
> > If it works the same way on linux and on cygwin, then there is
> > nothing to fix.
>
>Ok.  But where is this documented?
>
>I expected "#!/usr/bin/env perl -w" to work because I thought the
>line would be interpreted as on the command line (shell) and as is
>documented in the manual page for env.  Since the behaviour is
>different when the line is in the shebang line, it has to be
>documented somewhere.


Well if env documentation states a particular behavior and that behavior is
not what you see, then there is a bug in env or it's documentation.  You 
should contact it's maintainer and since it appears to be a general issue,
you should contact the GNU maintainer, not the Cygwin.



Larry Hall                              lhall@rfk.com
RFK Partners, Inc.                      http://www.rfk.com
838 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - FAX


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-12 17:54 ` Christopher Faylor
  2002-02-12 19:10   ` David Gluss
@ 2002-02-20 12:57   ` Peter J. Acklam
  2002-02-20 13:37     ` Larry Hall (RFK Partners, Inc)
  2002-02-20 21:33     ` Christopher Faylor
  1 sibling, 2 replies; 36+ messages in thread
From: Peter J. Acklam @ 2002-02-20 12:57 UTC (permalink / raw)
  To: cygwin

Christopher Faylor <cgf@redhat.com> wrote:

> If it works the same way on linux and on cygwin, then there is
> nothing to fix.

Ok.  But where is this documented?

I expected "#!/usr/bin/env perl -w" to work because I thought the
line would be interpreted as on the command line (shell) and as is
documented in the manual page for env.  Since the behaviour is
different when the line is in the shebang line, it has to be
documented somewhere.

Peter

-- 
People say I'm indifferent, but I don't care.


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* RE: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-13  6:26     ` Gerald S. Williams
                         ` (2 preceding siblings ...)
  2002-02-13  6:52       ` Benoit Rochefort
@ 2002-02-14 11:55       ` Gerald S. Williams
  3 siblings, 0 replies; 36+ messages in thread
From: Gerald S. Williams @ 2002-02-14 11:55 UTC (permalink / raw)
  To: cygwin

I did a little research, and Unix #! handling is all over
the spectrum, so any Unix portability argument goes out
the window. Other than tricks involving /bin/sh, the best
you can hope for is "#!/usr/bin/env PROG".

It would be a worthwhile exercise to see if enabling full
argument parsing breaks anything (i.e., find out if this
is a win-win feature), although this is hardly likely to
be on anyone's priority list soon.

-Jerry

-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-


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* RE: /usr/bin/env - Incorrect parsing of #! line?
@ 2002-02-13 14:13 Heribert Dahms
  0 siblings, 0 replies; 36+ messages in thread
From: Heribert Dahms @ 2002-02-13 14:13 UTC (permalink / raw)
  To: 'Lassi A. Tuura', cygwin; +Cc: 'pjacklam@online.no'

Hi,

another generic way would be a shell wrapper named "perl -w"
somewhere in the PATH e.g. /usr/local/bin,
so Peter wouldn't need to change a lot of scripts.


Bye, Heribert (heribert_dahms@icon-scm.com)

> -----Original Message-----
> From:	Lassi A. Tuura [SMTP:lassi.tuura@cern.ch]
> Sent:	Wednesday, February 13, 2002 20:15
> To:	cygwin@cygwin.com
> Subject:	Re: /usr/bin/env - Incorrect parsing of #! line?
> 
> > Find some other way to accomplish what you need to do.
> 
> #!/usr/bin/env perl
> BEGIN { $^W = 1; }
> 
> $foo = 0;
> 
> //lat
> -- 
> No matter how hard you try, you can't make a baby in much less than
> 9 months.  Trying to speed this up *might* make it slower, but it
> won't make it happen any quicker.
> 	--RFC1925, "The Twelve Networking Truths"
> 

--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-13 10:37 ` Christopher Faylor
@ 2002-02-13 11:14   ` Lassi A. Tuura
  0 siblings, 0 replies; 36+ messages in thread
From: Lassi A. Tuura @ 2002-02-13 11:14 UTC (permalink / raw)
  To: cygwin

> Find some other way to accomplish what you need to do.

#!/usr/bin/env perl
BEGIN { $^W = 1; }

$foo = 0;

//lat
-- 
No matter how hard you try, you can't make a baby in much less than
9 months.  Trying to speed this up *might* make it slower, but it
won't make it happen any quicker.
	--RFC1925, "The Twelve Networking Truths"

--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-13  6:53 Chet Ramey
@ 2002-02-13 10:37 ` Christopher Faylor
  2002-02-13 11:14   ` Lassi A. Tuura
  0 siblings, 1 reply; 36+ messages in thread
From: Christopher Faylor @ 2002-02-13 10:37 UTC (permalink / raw)
  To: cygwin

On Wed, Feb 13, 2002 at 09:52:23AM -0500, Chet Ramey wrote:
>>The problem looks to be that bash "helps out" the system by executing
>>scripts beginning with #!.  In the source for bash, look in
>>execute_cmd.c, line 3369.  Only one argument is allowed.  So e.g.
>>#!/usr/bin/env perl -w becomes "/usr/bin/env" "perl -w" If I make a
>>patch for this, should it go to the cygwin list?  Should it just go to
>>gnu.bash.bug and leave it at that?
>
>Only if the kernel doesn't do it, as discovered by configure.
>Virtually all Unices understand that executable format in the kernel.
>Cygwin does, too.

Right.  And, as I have noted, we're not going to be changing either
cygwin or bash.  The current behavior seems to be consistent with a
number of UNIXes.  I just tried it on OSF1 v3.2 and irix 5.3.  Same
result as cygwin.

Let's lay this one to rest.  Nothing is going to change.  Find some
other way to accomplish what you need to do.  Continued speculation
on how to change cygwin or bash is going to get you nowhere.

cgf

--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* RE: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-13  6:50 Chet Ramey
@ 2002-02-13  7:16 ` Gerald S. Williams
  0 siblings, 0 replies; 36+ messages in thread
From: Gerald S. Williams @ 2002-02-13  7:16 UTC (permalink / raw)
  To: cygwin; +Cc: dgluss, pjacklam, chet

If DG's assessment is correct:

> The problem looks to be that bash "helps out" the system
> by executing scripts beginning with #!.  In the source for
> bash, look in execute_cmd.c, line 3369.  Only one argument
> is allowed.  So e.g. #!/usr/bin/env perl -w becomes
> "/usr/bin/env" "perl -w"
> If I make a patch for this, should it go to the cygwin list?
> Should it just go to gnu.bash.bug and leave it at that?

Then it's a BASH issue. Some flavors of UNIX do this in the
kernel. If this is the case for CYGWIN, then it is a CYGWIN
issue as well. Either way, it sounds like DG has a pretty
good handle on this issue.

-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-


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
@ 2002-02-13  6:53 Chet Ramey
  2002-02-13 10:37 ` Christopher Faylor
  0 siblings, 1 reply; 36+ messages in thread
From: Chet Ramey @ 2002-02-13  6:53 UTC (permalink / raw)
  To: dgluss; +Cc: pjacklam, cygwin, chet

> The problem looks to be that bash "helps out" the system
> by executing scripts beginning with #!.  In the source for
> bash, look in execute_cmd.c, line 3369.  Only one argument
> is allowed.  So e.g. #!/usr/bin/env perl -w becomes
> "/usr/bin/env" "perl -w"
> If I make a patch for this, should it go to the cygwin list?
> Should it just go to gnu.bash.bug and leave it at that?

Only if the kernel doesn't do it, as discovered by configure.
Virtually all Unices understand that executable format in the
kernel.  Cygwin does, too.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)

Chet Ramey, CWRU    chet@po.CWRU.Edu    http://cnswww.cns.cwru.edu/~chet/

--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* RE: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-13  6:26     ` Gerald S. Williams
  2002-02-13  6:38       ` Michael Schaap
  2002-02-13  6:39       ` Robert Praetorius
@ 2002-02-13  6:52       ` Benoit Rochefort
  2002-02-14 11:55       ` Gerald S. Williams
  3 siblings, 0 replies; 36+ messages in thread
From: Benoit Rochefort @ 2002-02-13  6:52 UTC (permalink / raw)
  To: Gerald S. Williams; +Cc: cygwin, David Gluss, Peter J. Acklam

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.
] 
] It is also not limited to env--any time you use multiple
] arguments to #! you get into trouble. For example, the
] following fails:
] 
] #!/bin/python -tt -x
] print "hello, world"
] 
] 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.
] 
] 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.
] 
] 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.
] 
] I have also seen examples in popular Unix books (such
] as the O'Reilly nutshell books) that rely on multiple
] arguments.
] 
] -Jerry
] 
] -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-
] 
] 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.
] 
] 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.
] 
] 
] --
] 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/

-- 
           *º¤., ¸¸,.¤º*¨¨¨*¤  Benoit Rochefort  *º¤., ¸¸,.¤º*¨¨¨*¤

--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* RE: /usr/bin/env - Incorrect parsing of #! line?
@ 2002-02-13  6:50 Chet Ramey
  2002-02-13  7:16 ` Gerald S. Williams
  0 siblings, 1 reply; 36+ messages in thread
From: Chet Ramey @ 2002-02-13  6:50 UTC (permalink / raw)
  To: gsw; +Cc: cygwin, dgluss, pjacklam, chet

> 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.

How is changing bash going to do anything?  The kernel takes
care of executing files with a `#!' magic number.  I presume
that the cygwin dll handles this.

There is an incompatibility between the linux kernel and other
Unices in the way they parse arguments after the interpreter
name, but that's not really bash's business.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)

Chet Ramey, CWRU    chet@po.CWRU.Edu    http://cnswww.cns.cwru.edu/~chet/

--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* RE: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-13  6:26     ` Gerald S. Williams
  2002-02-13  6:38       ` Michael Schaap
@ 2002-02-13  6:39       ` Robert Praetorius
  2002-02-13  6:52       ` Benoit Rochefort
  2002-02-14 11:55       ` Gerald S. Williams
  3 siblings, 0 replies; 36+ messages in thread
From: Robert Praetorius @ 2002-02-13  6:39 UTC (permalink / raw)
  To: cygwin; +Cc: Gerald S. Williams

> 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.

     bashref.html says:

        "Suggestions and `philosophical' bug reports may be
        mailed to bug-bash@gnu.org or posted to the Usenet
        newsgroup gnu.bash.bug."

As was pointed out, cygwin will use whatever behavior bash implements.


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* RE: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-13  6:26     ` Gerald S. Williams
@ 2002-02-13  6:38       ` Michael Schaap
  2002-02-13  6:39       ` Robert Praetorius
                         ` (2 subsequent siblings)
  3 siblings, 0 replies; 36+ messages in thread
From: Michael Schaap @ 2002-02-13  6:38 UTC (permalink / raw)
  To: cygwin

At 15:25 13-2-2002, Gerald S. Williams wrote:
>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.

Not so sure it's a bash thing.
Ash and zsh on Cygwin do exactly the same.


>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.

HP-UX 10.20 behaves the same as Cygwin and Linux with bash, ksh and sh.


>I have also seen examples in popular Unix books (such
>as the O'Reilly nutshell books) that rely on multiple
>arguments.

Well, those are not portable examples, then.

  - Michael

-- 
     I always wondered about the meaning of life.   So I looked it
     up in the dictionary under "L" and there it was - the meaning
     of life.  It was not what I expected.                  - Dogbert 


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* RE: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-12 19:10   ` David Gluss
@ 2002-02-13  6:26     ` Gerald S. Williams
  2002-02-13  6:38       ` Michael Schaap
                         ` (3 more replies)
  0 siblings, 4 replies; 36+ messages in thread
From: Gerald S. Williams @ 2002-02-13  6:26 UTC (permalink / raw)
  To: cygwin; +Cc: David Gluss, Peter J. Acklam

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.

It is also not limited to env--any time you use multiple
arguments to #! you get into trouble. For example, the
following fails:

#!/bin/python -tt -x
print "hello, world"

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.

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.

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.

I have also seen examples in popular Unix books (such
as the O'Reilly nutshell books) that rely on multiple
arguments.

-Jerry

-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-

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.

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.


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-12 17:54 ` Christopher Faylor
@ 2002-02-12 19:10   ` David Gluss
  2002-02-13  6:26     ` Gerald S. Williams
  2002-02-20 12:57   ` Peter J. Acklam
  1 sibling, 1 reply; 36+ messages in thread
From: David Gluss @ 2002-02-12 19:10 UTC (permalink / raw)
  To: cygwin

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.
DG
----- Original Message ----- 
From: "Christopher Faylor" <cgf@redhat.com>
To: <cygwin@cygwin.com>
Sent: Tuesday, February 12, 2002 5:54 PM
Subject: Re: /usr/bin/env - Incorrect parsing of #! line?


> On Tue, Feb 12, 2002 at 05:31:03PM -0800, David Gluss wrote:
> >The problem looks to be that bash "helps out" the system by executing
> >scripts beginning with #!.  In the source for bash, look in
> >execute_cmd.c, line 3369.  Only one argument is allowed.  So e.g.
> >#!/usr/bin/env perl -w becomes "/usr/bin/env" "perl -w" If I make a
> >patch for this, should it go to the cygwin list?  Should it just go to
> >gnu.bash.bug and leave it at that?
> 
> I think you're misinterpreting the problem.  If it works the same way
> on linux and on cygwin, then there is nothing to fix.
> 
> cgf
> 
> --
> 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/
> 


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
  2002-02-12 17:47 David Gluss
@ 2002-02-12 17:54 ` Christopher Faylor
  2002-02-12 19:10   ` David Gluss
  2002-02-20 12:57   ` Peter J. Acklam
  0 siblings, 2 replies; 36+ messages in thread
From: Christopher Faylor @ 2002-02-12 17:54 UTC (permalink / raw)
  To: cygwin

On Tue, Feb 12, 2002 at 05:31:03PM -0800, David Gluss wrote:
>The problem looks to be that bash "helps out" the system by executing
>scripts beginning with #!.  In the source for bash, look in
>execute_cmd.c, line 3369.  Only one argument is allowed.  So e.g.
>#!/usr/bin/env perl -w becomes "/usr/bin/env" "perl -w" If I make a
>patch for this, should it go to the cygwin list?  Should it just go to
>gnu.bash.bug and leave it at that?

I think you're misinterpreting the problem.  If it works the same way
on linux and on cygwin, then there is nothing to fix.

cgf

--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: /usr/bin/env - Incorrect parsing of #! line?
@ 2002-02-12 17:47 David Gluss
  2002-02-12 17:54 ` Christopher Faylor
  0 siblings, 1 reply; 36+ messages in thread
From: David Gluss @ 2002-02-12 17:47 UTC (permalink / raw)
  To: Peter J. Acklam; +Cc: cygwin

The problem looks to be that bash "helps out" the system
by executing scripts beginning with #!.  In the source for
bash, look in execute_cmd.c, line 3369.  Only one argument
is allowed.  So e.g. #!/usr/bin/env perl -w becomes
"/usr/bin/env" "perl -w"
If I make a patch for this, should it go to the cygwin list?
Should it just go to gnu.bash.bug and leave it at that?
DG 


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* /usr/bin/env - Incorrect parsing of #! line?
@ 2002-02-12 15:22 Chris January
  0 siblings, 0 replies; 36+ messages in thread
From: Chris January @ 2002-02-12 15:22 UTC (permalink / raw)
  To: cygwin

> > > I use different computers where Perl is installed different
> > > places, so I can't hardcode the location of perl in the shebang
> > > line.  Thus, I use env, which works great on all UNIXes I work on,
> > > for instance
> > >
> > >     #!/usr/bin/env perl -w
> > >
> > >     print "This is Perl version $]\n";
> > >
> > > but on Cygwin I get
> > >
> > >     /usr/bin/env: perl -w: No such file or directory
> > >
> > > why does Cygwin look for the file "perl -w".  No UNIX I have
> > > worked on would parse the shebang line that way.
> > Linux parses things this way too. I don't know what "UNIX"'s this works
> on.
> > (Sun, HP?)
More specifically it's a quoting issue.
Try:
/usr/bin/env perl -w
on the command line and compare with
"/usr/bin/env perl -w"

Regards
Chris

 
> 


--
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/

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2002-02-22 13:21 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-12 10:38 /usr/bin/env - Incorrect parsing of #! line? Peter J. Acklam
2002-02-12 10:53 ` Christopher Faylor
2002-02-12 12:16   ` Peter J. Acklam
2002-02-12 14:25     ` Charles Wilson
2002-02-12 14:59       ` David Gluss
2002-02-20 13:03       ` Peter J. Acklam
2002-02-12 11:56 ` David Gluss
2002-02-12 12:17   ` Peter J. Acklam
2002-02-12 13:56     ` David Gluss
2002-02-12 14:57 ` Chris January
2002-02-20 12:57   ` Peter J. Acklam
2002-02-12 15:22 Chris January
2002-02-12 17:47 David Gluss
2002-02-12 17:54 ` Christopher Faylor
2002-02-12 19:10   ` David Gluss
2002-02-13  6:26     ` Gerald S. Williams
2002-02-13  6:38       ` Michael Schaap
2002-02-13  6:39       ` Robert Praetorius
2002-02-13  6:52       ` Benoit Rochefort
2002-02-14 11:55       ` Gerald S. Williams
2002-02-20 12:57   ` Peter J. Acklam
2002-02-20 13:37     ` Larry Hall (RFK Partners, Inc)
2002-02-21 12:47       ` Peter J. Acklam
2002-02-21 13:04         ` Peter J. Acklam
2002-02-21 19:10         ` William F. Hammond
2002-02-20 21:33     ` Christopher Faylor
2002-02-21 13:23       ` Peter J. Acklam
2002-02-13  6:50 Chet Ramey
2002-02-13  7:16 ` Gerald S. Williams
2002-02-13  6:53 Chet Ramey
2002-02-13 10:37 ` Christopher Faylor
2002-02-13 11:14   ` Lassi A. Tuura
2002-02-13 14:13 Heribert Dahms
2002-02-22  1:27 pjacklam
2002-02-22  4:34 ` Michael Schaap
2002-02-22  5:26 pjacklam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).