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: 49908
Status: resolved
Priority: 0/
Queue: File-Which

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

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



Subject: failing cygwin test
On cygwin 1.7 I get not ok 8 - Looking for test1 on Cygwin: transparent to test1.exe # Failed test 'Looking for test1 on Cygwin: transparent to test1.exe' # at t/03_simple.t line 67. # got: undef # expected: 't/test-bin/test1' This is because t/test-bin/test1.exe has no -x therefore it is not found. Either fix it in your tar or fix it in the test as below diff -u t/03_simple.t~ t/03_simple.t --- t/03_simple.t~ 2009-09-14 20:02:16.000000000 +0200 +++ t/03_simple.t 2009-09-22 15:25:58.421875000 +0200 @@ -63,6 +63,7 @@ SKIP: { skip("Not on a cygwin filesystem", 2) unless IS_CYGWIN; + chmod 0755, File::Spec->catfile( $test_bin, 'test1' ); # Cygwin: should make test1.exe transparent is( scalar(which('test1')), -- Reini Urban
^ BUMP. According to this(1) - "Cygwin fakes the execute permission only for the suffixes exe, bat, com". However, this (2) document says its exe only. So, ideally, the PATHEXT logic used for IS_DOS should be applied to Cygwin as well. Currently, trying to find an 'exe' on Cygwin fails unless the file itself contains the extension and has a cygwin execute bit set. (1) - http://cygwin.com/ml/cygwin-developers/2000-10/msg00044.html (2) - http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-exe -- Mithun
Attaching a patch for cygwin `.exe` handling.
Subject: 49908.patch
--- 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
I propose an alternate solution, which works for .com and .bat files in addition to .exes: diff --git a/lib/File/Which.pm b/lib/File/Which.pm index 327e8b4..8488307 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, split ';', $ENV{PATHEXT}; } sub which { @@ -89,7 +94,7 @@ sub which { IS_MAC || ( - IS_DOS + ( IS_DOS or IS_CYG ) and grep { $file =~ /$_\z/i
I have merged my patch and it will be included in version 1.10 due shortly. Please let me know if this does not resolve the issue for you.