delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/01/23/22:29:22

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW
X-Spam-Check-By: sourceware.org
Message-ID: <4D3CF1E2.2020409@cpan.org>
Date: Sun, 23 Jan 2011 22:28:34 -0500
From: Rafael Kitover <rkitover AT cpan DOT org>
Reply-To: rkitover AT cpan DOT org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: windows paths in shebang lines
References: <4D3CA1DA DOT 1000302 AT cpan DOT org> <4D3CB2ED DOT 5000801 AT bopp DOT net> <ihickl$dn4$1 AT dough DOT gmane DOT org>
In-Reply-To: <ihickl$dn4$1@dough.gmane.org>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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 AT eeebox ~
>>> $ head -1 /cygdrive/c/Perl64/site/bin/ack
>>> #!C:\Perl64\bin\perl
>>>
>>> rkitover AT 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 AT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019