Skip Menu |
 

This queue is for tickets about the ExtUtils-MakeMaker CPAN distribution.

Report information
The Basics
Id: 16375
Status: resolved
Priority: 0/
Queue: ExtUtils-MakeMaker

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

Bug Information
Severity: Normal
Broken in: 6.30_01
Fixed in: (no value)

Attachments


Subject: maybe_command() always fails on cygwin systems when examining paths in /cygdrive/*
Download (untitled) / with headers
text/plain 595b
G'day Michael / MM maintainers, Perl 5.8.7 (and probably earlier releases) under cygwin appears to never return a true value for the '-x' switch when examining files in /cygdrive/* . As a result, MM_Cygwin::maybe_command() will always return false for these files, even if they really are executable. The attached patch adjusts MM_Cygwin such that: * We use MM_Win32::maybe_command if our path begins with /cygdrive/... * We use MM_Unix::maybe_command otherwise. Test cases have been added to MM_Cygwin.t. Feedback, questions, and comments are appreciated. Cheers, Paul Fenwick
diff -ru ExtUtils-MakeMaker-6.30/lib/ExtUtils/MM_Cygwin.pm ExtUtils-MakeMaker-6.30-pjf/lib/ExtUtils/MM_Cygwin.pm --- ExtUtils-MakeMaker-6.30/lib/ExtUtils/MM_Cygwin.pm 2005-03-22 15:31:50.000000000 +1100 +++ ExtUtils-MakeMaker-6.30-pjf/lib/ExtUtils/MM_Cygwin.pm 2005-12-09 12:37:02.110742400 +1100 @@ -8,6 +8,7 @@ require ExtUtils::MM_Any; require ExtUtils::MM_Unix; +require ExtUtils::MM_Win32; # For 'maybe_command' @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); $VERSION = '1.08'; @@ -99,6 +100,24 @@ $self->{EXPORT_LIST} ||= ''; } +=item maybe_command + +If our path begins with F</cygdrive/> then we use C<ExtUtils::MM_Win32> +to determine if it may be a command. Otherwise we use the tests +from C<ExtUtils::MM_Unix>. + +=cut + +sub maybe_command { + my ($self, $file) = @_; + + if ($file =~ m{^/cygdrive/}i) { + return ExtUtils::MM_Win32->maybe_command($file); + } + + return $self->SUPER::maybe_command($file); +} + =back =cut diff -ru ExtUtils-MakeMaker-6.30/t/MM_Cygwin.t ExtUtils-MakeMaker-6.30-pjf/t/MM_Cygwin.t --- ExtUtils-MakeMaker-6.30/t/MM_Cygwin.t 2005-02-26 17:15:06.000000000 +1100 +++ ExtUtils-MakeMaker-6.30-pjf/t/MM_Cygwin.t 2005-12-09 12:51:20.184592000 +1100 @@ -16,7 +16,7 @@ BEGIN { if ($^O =~ /cygwin/i) { - plan tests => 11; + plan tests => 14; } else { plan skip_all => "This is not cygwin"; } @@ -25,6 +25,7 @@ use Config; use File::Spec; use ExtUtils::MM; +use Config; use_ok( 'ExtUtils::MM_Cygwin' ); @@ -97,7 +98,37 @@ is( $MM->{EXPORT_LIST}, $export, 'EXPORT_LIST' ); } +# Tests for correct handling of maybe_command in /cygdrive/* +# and c:/*. $ENV{COMSPEC}, if it exists, should always be executable. + +SKIP: { + + my $comspec = $ENV{COMSPEC}; + + skip("\$ENV{COMSPEC} does not exist",1) unless $comspec; + + # Convert into cygwin-flavoured '/cygdrive/c/...' path. + # Is there a better way than direct munging? A File::* + # module perhaps? + + $comspec =~ s{^(\w):} {/cygdrive/\l$1}x; + $comspec =~ s{\\ } {/}gx; + ok(MM->maybe_command($comspec),"$comspec should be executable"); + + # /cygdrive/c should *never* be executable, it's a directory. + + ok(! MM->maybe_command(q{/cygdrive/c}), + qq{/cygdrive/c should never be executable} + ); + + # Our copy of Perl (with a unix-path) should always be executable. + + ok(MM->maybe_command($Config{perlpath}), + qq{$Config{perlpath} should be executable} + ); + +} package FakeOut;
Patched in, thanks. Sorry for the delay.


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.