Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the File-Which CPAN distribution.

Report information
The Basics
Id: 83146
Status: resolved
Priority: 0/
Queue: File-Which

People
Owner: Nobody in particular
Requestors: MITHUN [...] cpan.org
Cc: PLICEASE [...] cpan.org
AdminCc:

Bug Information
Severity: Important
Broken in: 1.09
Fixed in: (no value)



Subject: Fails to find EXEs on cygwin
Download (untitled) / with headers
text/plain 377b
This is sort of related to #49908. In some cases, EXEs installed via Windows (e.g. java.exe) are not found using `which`. This occurs when the EXE does not have the execute bit set when listed (`ls -l`) via a cygwin shell. However, those EXEs are still executable and run OK. I've attached a patch that seems to work for me. Please consider applying it. Thanks, -- Mithun
Subject: 49908.patch
Download 49908.patch
text/x-diff 797b
--- Which.pm 2013-02-02 22:04:00.000000000 -0600 +++ Which.pm.orig 2013-02-02 21:48:26.000000000 -0600 @@ -16,7 +16,6 @@ use constant IS_VMS => ($^O eq 'VMS'); use constant IS_MAC => ($^O eq 'MacOS'); use constant IS_DOS => ($^O eq 'MSWin32' or $^O eq 'dos' or $^O eq 'os2'); -use constant IS_CYG => ($^O eq 'cygwin'); # For Win32 systems, stores the extensions used for # executable files @@ -33,11 +32,6 @@ } } elsif ( IS_VMS ) { push @PATHEXT, qw{.exe .com}; -} elsif ( IS_CYG ) { - - # See this for more info - # http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-exe - push @PATHEXT, qw{.exe}; } sub which { @@ -95,7 +89,7 @@ IS_MAC || ( - ( IS_DOS or IS_CYG ) + IS_DOS and grep { $file =~ /$_\z/i
Instead of hardcoding '.exe', use $Config{_exe}.
Download (untitled) / with headers
text/plain 1.2k
After further testing I see that cygwin supports .com and .exe but not .bat or PATHEXT diff --git a/lib/File/Which.pm b/lib/File/Which.pm index 327e8b4..06cefe3 100644 --- a/lib/File/Which.pm +++ b/lib/File/Which.pm @@ -16,6 +16,7 @@ BEGIN { use constant IS_VMS => ($^O eq 'VMS'); use constant IS_MAC => ($^O eq 'MacOS'); use constant IS_DOS => ($^O eq 'MSWin32' or $^O eq 'dos' or $^O eq 'os2'); +use constant IS_CYG => ($^O eq 'cygwin'); # For Win32 systems, stores the extensions used for # executable files @@ -32,6 +33,10 @@ if ( IS_DOS ) { } } elsif ( IS_VMS ) { push @PATHEXT, qw{.exe .com}; +} elsif ( IS_CYG ) { + # See this for more info + # http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-exe + push @PATHEXT, qw{.exe .com}; } sub which { @@ -89,7 +94,7 @@ sub which { IS_MAC || ( - IS_DOS + ( IS_DOS or IS_CYG ) and grep { $file =~ /$_\z/i
Download (untitled) / with headers
text/plain 169b
On Mon Feb 02 19:54:14 2015, ETHER wrote: Show quoted text
> Instead of hardcoding '.exe', use $Config{_exe}.
In this case $Config{_exe} is wrong. It covers the .exe case but not .com.
Download (untitled) / with headers
text/plain 316b
On Tue Feb 03 08:00:00 2015, PLICEASE wrote: Show quoted text
> On Mon Feb 02 19:54:14 2015, ETHER wrote:
> > Instead of hardcoding '.exe', use $Config{_exe}.
> > In this case $Config{_exe} is wrong. It covers the .exe case but not .com.
"wrong" is a strong word, what I mean to say is that $Config{_exe} does not cover all cases.
This will be fixed in 1.10. Please let me know if you find this not to be the case.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.