Re: windows paths in shebang lines

2011-01-26 Thread Christopher Faylor
On Sun, Jan 23, 2011 at 10:26:15PM -0500, Rafael Kitover wrote:
msys seems to do something special for this to work correctly, it also
seems to translate its paths to windows paths when running windows
executables automatically, a very nice feature.

Command line munging is a nice feature if you're bastardizing the Cygwin
DLL to sorta work with Windows apps which may or may not take a Windows
PATH.  It's an absolutely terrible feature if you are striving for
compatibility with Linux/POSIX.

cgf

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: windows paths in shebang lines

2011-01-25 Thread Rafael Kitover

On 1/23/2011 10:26 PM, Rafael Kitover wrote:

On 1/23/2011 5:59 PM, Jeremy Bopp wrote:

On 01/23/2011 03:47 PM, Rafael Kitover wrote:

When a script's shebang line has a windows path, rather than a cygwin
path, it does not work:

rkitover@eeebox ~
$ head -1 /cygdrive/c/Perl64/site/bin/ack
#!C:\Perl64\bin\perl

rkitover@eeebox ~
$ /cygdrive/c/Perl64/site/bin/ack --version
Can't open perl script /cygdrive/c/Perl64/site/bin/ack: No such file
or directory

On msys (msysGit) this works correctly:

rkitover@EEEBOX ~
$ /c/Perl64/site/bin/ack --version
ack 1.94
Running under Perl 5.12.2 at C:\Perl64\bin\perl.exe

Copyright 2005-2010 Andy Lester.

This program is free software. You may modify or distribute it
under the terms of the Artistic License v2.0.

Any chance this could be fixed? This would be a very nice feature for
users of Strawberry Perl and similar.


The problem is not that you're using a Windows path instead of a Cygwin
path in the shebang line; although, that is not officially supported
under Cygwin. Rather, the problem is that the version of Perl being run
as a result of that shebang line does not understand Cygwin paths.
That's why you see this error:

Can't open perl script /cygdrive/c/Perl64/site/bin/ack: No such file
or directory

That's the Perl interpreter telling you that it doesn't understand the
path that was given to it for the ack script, so Perl is running at this
point which means that the shebang line is understood correctly. You
should probably go read about how shebang lines work in general, but the
short and sweet is that the shebang line is the first part of a command
line to be run where the last part is the command line used to run the
file that contains the shebang line itself. IOW, the command line used
in your first example is ultimately:

C:\Perl64\bin\perl /cygdrive/c/Perl64/site/bin/ack --version


Ahh yes, I wasn't thinking about this clearly, thank you for the
explanation :)



You have 3 potential solutions to your problem:

1) Run Perl explicitly with the Windows path to the script as an
argument:
/cygdrive/c/Perl64/bin/perl C:/Perl64/site/bin/ack

2) Change into the C: drive and use a relative path to the ack script
when you run it:
cd /cygdrive/c
Perl64/site/bin/ack

3) Change your cygdrive mount location to / so that the path to the ack
script will be /c/Perl64/site/bin/ack under Cygwin.

Option 3 is the real hack. I think it should work because it appears in
your successful example that the Perl you want to use is able to
translate paths such as /c/path/to/something to C:/path/to/something
internally. By adjusting the cygdrive mount location to /, you will
cause Cygwin to send a compatible path to Perl when you run the script
as /c/Perl64/site/bin/ack.

-Jeremy


Unfortunately, that's not enough to get it to work:

$ /c/Perl64/site/bin/ack --version
Can't open perl script /c/Perl64/site/bin/ack: No such file or directory

$ /c/Perl64/bin/perl /c/Perl64/site/bin/ack --version
Can't open perl script /c/Perl64/site/bin/ack: No such file or directory

$ /c/Perl64/bin/perl /Perl64/site/bin/ack --version
ack 1.94
Running under Perl 5.12.2 at C:\Perl64\bin\perl.exe
...

msys seems to do something special for this to work correctly, it also
seems to translate its paths to windows paths when running windows
executables automatically, a very nice feature.

For this to work in cygwin I'd have to do something like mount c: as /,
which I'm guessing would break absolutely everything :)


I got this to work!

Along with mount -c / I did this:

mklink /D c:\c c:\

to create a directory junction.

Now:

$ head -1 /c/Perl64/site/bin/ack
#!C:\Perl64\bin\perl

rkitover@eeebox ~
$ /c/Perl64/site/bin/ack --version
ack 1.94
Running under Perl 5.12.2 at C:\Perl64\bin\perl.exe

Yay!

Now I just need to convince activestate to use proper shebang lines 
instead of #!/usr/bin/perl .


--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: windows paths in shebang lines

2011-01-25 Thread Andrew DeFaria

 On 01/25/2011 08:50 AM, Rafael Kitover wrote:
Now I just need to convince activestate to use proper shebang lines 
instead of #!/usr/bin/perl .

Again I query - why use ActiveState Perl instead of just Cygwin's own Perl?
--
Andrew DeFaria http://defaria.com
Can you sentence a homeless man to house arrest?


--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: windows paths in shebang lines

2011-01-25 Thread Maurice Mengel
There could a few good reasons to prefer Perl/ActiveState over
Perl/cygwin, but then this would still be the wrong list.

I hear that ActiveState has good support.

BTW: I don't remember how I did that when I last tried to work with
Perl/ActiveState (in WinNT times). There were several solutions and
one of the simpler ones was to call the scripts like this
   perl script.pl


On Tue, Jan 25, 2011 at 1:57 PM, Andrew DeFaria and...@defaria.com wrote:
  On 01/25/2011 08:50 AM, Rafael Kitover wrote:

 Now I just need to convince activestate to use proper shebang lines
 instead of #!/usr/bin/perl .

 Again I query - why use ActiveState Perl instead of just Cygwin's own Perl?
 --
 Andrew DeFaria http://defaria.com
 Can you sentence a homeless man to house arrest?


 --
 Problem reports:       http://cygwin.com/problems.html
 FAQ:                   http://cygwin.com/faq/
 Documentation:         http://cygwin.com/docs.html
 Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: windows paths in shebang lines

2011-01-25 Thread Andrew DeFaria

 On 01/25/2011 02:05 PM, Maurice Mengel wrote:

There could a few good reasons to prefer Perl/ActiveState over Perl/cygwin,
That's one reason why I was asking Rafael - what was his good reasons. I 
know of a number of good reasons to favor Cygwin's Perl (and one would 
be not to have to deal with windows paths in the shebang lines!).

  but then this would still be the wrong list.
I think promoting Cygwin, including Cygwin's Perl, is of good interest 
for even this list.

I hear that ActiveState has good support.
I don't know about that. The Perl community in general supports Perl 
very well and most of them think Unix and not Windows.

--
Andrew DeFaria http://defaria.com
A day without sunshine is like night.


--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



windows paths in shebang lines

2011-01-23 Thread Rafael Kitover
When a script's shebang line has a windows path, rather than a cygwin 
path, it does not work:


rkitover@eeebox ~
$ head -1 /cygdrive/c/Perl64/site/bin/ack
#!C:\Perl64\bin\perl

rkitover@eeebox ~
$ /cygdrive/c/Perl64/site/bin/ack --version
Can't open perl script /cygdrive/c/Perl64/site/bin/ack: No such file 
or directory


On msys (msysGit) this works correctly:

rkitover@EEEBOX ~
$ /c/Perl64/site/bin/ack --version
ack 1.94
Running under Perl 5.12.2 at C:\Perl64\bin\perl.exe

Copyright 2005-2010 Andy Lester.

This program is free software.  You may modify or distribute it
under the terms of the Artistic License v2.0.

Any chance this could be fixed? This would be a very nice feature for 
users of Strawberry Perl and similar.


--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: windows paths in shebang lines

2011-01-23 Thread Jeremy Bopp
On 01/23/2011 03:47 PM, Rafael Kitover wrote:
 When a script's shebang line has a windows path, rather than a cygwin
 path, it does not work:
 
 rkitover@eeebox ~
 $ head -1 /cygdrive/c/Perl64/site/bin/ack
 #!C:\Perl64\bin\perl
 
 rkitover@eeebox ~
 $ /cygdrive/c/Perl64/site/bin/ack --version
 Can't open perl script /cygdrive/c/Perl64/site/bin/ack: No such file
 or directory
 
 On msys (msysGit) this works correctly:
 
 rkitover@EEEBOX ~
 $ /c/Perl64/site/bin/ack --version
 ack 1.94
 Running under Perl 5.12.2 at C:\Perl64\bin\perl.exe
 
 Copyright 2005-2010 Andy Lester.
 
 This program is free software.  You may modify or distribute it
 under the terms of the Artistic License v2.0.
 
 Any chance this could be fixed? This would be a very nice feature for
 users of Strawberry Perl and similar.

The problem is not that you're using a Windows path instead of a Cygwin
path in the shebang line; although, that is not officially supported
under Cygwin.  Rather, the problem is that the version of Perl being run
as a result of that shebang line does not understand Cygwin paths.
That's why you see this error:

Can't open perl script /cygdrive/c/Perl64/site/bin/ack: No such file
or directory

That's the Perl interpreter telling you that it doesn't understand the
path that was given to it for the ack script, so Perl is running at this
point which means that the shebang line is understood correctly.  You
should probably go read about how shebang lines work in general, but the
short and sweet is that the shebang line is the first part of a command
line to be run where the last part is the command line used to run the
file that contains the shebang line itself.  IOW, the command line used
in your first example is ultimately:

C:\Perl64\bin\perl /cygdrive/c/Perl64/site/bin/ack --version

You have 3 potential solutions to your problem:

1) Run Perl explicitly with the Windows path to the script as an argument:
  /cygdrive/c/Perl64/bin/perl C:/Perl64/site/bin/ack

2) Change into the C: drive and use a relative path to the ack script
when you run it:
  cd /cygdrive/c
  Perl64/site/bin/ack

3) Change your cygdrive mount location to / so that the path to the ack
script will be /c/Perl64/site/bin/ack under Cygwin.

Option 3 is the real hack.  I think it should work because it appears in
your successful example that the Perl you want to use is able to
translate paths such as /c/path/to/something to C:/path/to/something
internally.  By adjusting the cygdrive mount location to /, you will
cause Cygwin to send a compatible path to Perl when you run the script
as /c/Perl64/site/bin/ack.

-Jeremy

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: windows paths in shebang lines

2011-01-23 Thread Andrew DeFaria

 On 01/23/2011 05:59 PM, Jeremy Bopp wrote:

On 01/23/2011 03:47 PM, Rafael Kitover wrote:

When a script's shebang line has a windows path, rather than a cygwin
path, it does not work:

rkitover@eeebox ~
$ head -1 /cygdrive/c/Perl64/site/bin/ack
#!C:\Perl64\bin\perl

rkitover@eeebox ~
$ /cygdrive/c/Perl64/site/bin/ack --version
Can't open perl script /cygdrive/c/Perl64/site/bin/ack: No such file
or directory

On msys (msysGit) this works correctly:

rkitover@EEEBOX ~
$ /c/Perl64/site/bin/ack --version
ack 1.94
Running under Perl 5.12.2 at C:\Perl64\bin\perl.exe

Copyright 2005-2010 Andy Lester.

This program is free software.  You may modify or distribute it
under the terms of the Artistic License v2.0.

Any chance this could be fixed? This would be a very nice feature for
users of Strawberry Perl and similar.

The problem is not that you're using a Windows path instead of a Cygwin
path in the shebang line; although, that is not officially supported
under Cygwin.  Rather, the problem is that the version of Perl being run
as a result of that shebang line does not understand Cygwin paths.
That's why you see this error:

Can't open perl script /cygdrive/c/Perl64/site/bin/ack: No such file
or directory

That's the Perl interpreter telling you that it doesn't understand the
path that was given to it for the ack script, so Perl is running at this
point which means that the shebang line is understood correctly.  You
should probably go read about how shebang lines work in general, but the
short and sweet is that the shebang line is the first part of a command
line to be run where the last part is the command line used to run the
file that contains the shebang line itself.  IOW, the command line used
in your first example is ultimately:

C:\Perl64\bin\perl /cygdrive/c/Perl64/site/bin/ack --version

You have 3 potential solutions to your problem:

1) Run Perl explicitly with the Windows path to the script as an argument:
   /cygdrive/c/Perl64/bin/perl C:/Perl64/site/bin/ack

2) Change into the C: drive and use a relative path to the ack script
when you run it:
   cd /cygdrive/c
   Perl64/site/bin/ack

3) Change your cygdrive mount location to / so that the path to the ack
script will be /c/Perl64/site/bin/ack under Cygwin.

Option 3 is the real hack.  I think it should work because it appears in
your successful example that the Perl you want to use is able to
translate paths such as /c/path/to/something to C:/path/to/something
internally.  By adjusting the cygdrive mount location to /, you will
cause Cygwin to send a compatible path to Perl when you run the script
as /c/Perl64/site/bin/ack.

-Jeremy

My question would be: Why are you running a C:\Perl64\bin\perl.exe 
instead of just running /usr/bin/perl (AKA C:/Cygwin/bin/perl.exe)? IOW 
why are you not running Cygwin's Perl. My guess is that 
C:\Perl64\bin\perl.exe is some ActiveState based Perl and you'll only 
run into problems using that with a Cygwin frame of mine. Just run 
Cygwin's Perl instead!

--
Andrew DeFaria http://defaria.com
Friends may come and go, but enemies accumulate.


--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: windows paths in shebang lines

2011-01-23 Thread Rafael Kitover

On 1/23/2011 5:59 PM, Jeremy Bopp wrote:

On 01/23/2011 03:47 PM, Rafael Kitover wrote:

When a script's shebang line has a windows path, rather than a cygwin
path, it does not work:

rkitover@eeebox ~
$ head -1 /cygdrive/c/Perl64/site/bin/ack
#!C:\Perl64\bin\perl

rkitover@eeebox ~
$ /cygdrive/c/Perl64/site/bin/ack --version
Can't open perl script /cygdrive/c/Perl64/site/bin/ack: No such file
or directory

On msys (msysGit) this works correctly:

rkitover@EEEBOX ~
$ /c/Perl64/site/bin/ack --version
ack 1.94
Running under Perl 5.12.2 at C:\Perl64\bin\perl.exe

Copyright 2005-2010 Andy Lester.

This program is free software.  You may modify or distribute it
under the terms of the Artistic License v2.0.

Any chance this could be fixed? This would be a very nice feature for
users of Strawberry Perl and similar.


The problem is not that you're using a Windows path instead of a Cygwin
path in the shebang line; although, that is not officially supported
under Cygwin.  Rather, the problem is that the version of Perl being run
as a result of that shebang line does not understand Cygwin paths.
That's why you see this error:

Can't open perl script /cygdrive/c/Perl64/site/bin/ack: No such file
or directory

That's the Perl interpreter telling you that it doesn't understand the
path that was given to it for the ack script, so Perl is running at this
point which means that the shebang line is understood correctly.  You
should probably go read about how shebang lines work in general, but the
short and sweet is that the shebang line is the first part of a command
line to be run where the last part is the command line used to run the
file that contains the shebang line itself.  IOW, the command line used
in your first example is ultimately:

C:\Perl64\bin\perl /cygdrive/c/Perl64/site/bin/ack --version


Ahh yes, I wasn't thinking about this clearly, thank you for the 
explanation :)




You have 3 potential solutions to your problem:

1) Run Perl explicitly with the Windows path to the script as an argument:
   /cygdrive/c/Perl64/bin/perl C:/Perl64/site/bin/ack

2) Change into the C: drive and use a relative path to the ack script
when you run it:
   cd /cygdrive/c
   Perl64/site/bin/ack

3) Change your cygdrive mount location to / so that the path to the ack
script will be /c/Perl64/site/bin/ack under Cygwin.

Option 3 is the real hack.  I think it should work because it appears in
your successful example that the Perl you want to use is able to
translate paths such as /c/path/to/something to C:/path/to/something
internally.  By adjusting the cygdrive mount location to /, you will
cause Cygwin to send a compatible path to Perl when you run the script
as /c/Perl64/site/bin/ack.

-Jeremy


Unfortunately, that's not enough to get it to work:

$ /c/Perl64/site/bin/ack --version
Can't open perl script /c/Perl64/site/bin/ack: No such file or directory

$ /c/Perl64/bin/perl /c/Perl64/site/bin/ack --version
Can't open perl script /c/Perl64/site/bin/ack: No such file or directory

$ /c/Perl64/bin/perl /Perl64/site/bin/ack --version
ack 1.94
Running under Perl 5.12.2 at C:\Perl64\bin\perl.exe
...

msys seems to do something special for this to work correctly, it also 
seems to translate its paths to windows paths when running windows 
executables automatically, a very nice feature.


For this to work in cygwin I'd have to do something like mount c: as /, 
which I'm guessing would break absolutely everything :)


--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: windows paths in shebang lines

2011-01-23 Thread Rafael Kitover

On 1/23/2011 6:12 PM, Andrew DeFaria wrote:

On 01/23/2011 05:59 PM, Jeremy Bopp wrote:

On 01/23/2011 03:47 PM, Rafael Kitover wrote:

When a script's shebang line has a windows path, rather than a cygwin
path, it does not work:

rkitover@eeebox ~
$ head -1 /cygdrive/c/Perl64/site/bin/ack
#!C:\Perl64\bin\perl

rkitover@eeebox ~
$ /cygdrive/c/Perl64/site/bin/ack --version
Can't open perl script /cygdrive/c/Perl64/site/bin/ack: No such file
or directory

On msys (msysGit) this works correctly:

rkitover@EEEBOX ~
$ /c/Perl64/site/bin/ack --version
ack 1.94
Running under Perl 5.12.2 at C:\Perl64\bin\perl.exe

Copyright 2005-2010 Andy Lester.

This program is free software. You may modify or distribute it
under the terms of the Artistic License v2.0.

Any chance this could be fixed? This would be a very nice feature for
users of Strawberry Perl and similar.

The problem is not that you're using a Windows path instead of a Cygwin
path in the shebang line; although, that is not officially supported
under Cygwin. Rather, the problem is that the version of Perl being run
as a result of that shebang line does not understand Cygwin paths.
That's why you see this error:

Can't open perl script /cygdrive/c/Perl64/site/bin/ack: No such file
or directory

That's the Perl interpreter telling you that it doesn't understand the
path that was given to it for the ack script, so Perl is running at this
point which means that the shebang line is understood correctly. You
should probably go read about how shebang lines work in general, but the
short and sweet is that the shebang line is the first part of a command
line to be run where the last part is the command line used to run the
file that contains the shebang line itself. IOW, the command line used
in your first example is ultimately:

C:\Perl64\bin\perl /cygdrive/c/Perl64/site/bin/ack --version

You have 3 potential solutions to your problem:

1) Run Perl explicitly with the Windows path to the script as an
argument:
/cygdrive/c/Perl64/bin/perl C:/Perl64/site/bin/ack

2) Change into the C: drive and use a relative path to the ack script
when you run it:
cd /cygdrive/c
Perl64/site/bin/ack

3) Change your cygdrive mount location to / so that the path to the ack
script will be /c/Perl64/site/bin/ack under Cygwin.

Option 3 is the real hack. I think it should work because it appears in
your successful example that the Perl you want to use is able to
translate paths such as /c/path/to/something to C:/path/to/something
internally. By adjusting the cygdrive mount location to /, you will
cause Cygwin to send a compatible path to Perl when you run the script
as /c/Perl64/site/bin/ack.

-Jeremy


My question would be: Why are you running a C:\Perl64\bin\perl.exe
instead of just running /usr/bin/perl (AKA C:/Cygwin/bin/perl.exe)? IOW
why are you not running Cygwin's Perl. My guess is that
C:\Perl64\bin\perl.exe is some ActiveState based Perl and you'll only
run into problems using that with a Cygwin frame of mine. Just run
Cygwin's Perl instead!


But I do! :)

I'm a CPAN developer, I love all perls and run as many of them as 
possible :)


--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple