Subject: | [PATCH] Don't hardcode /cygdrive |
'make test' in blead perl is producing the following failure:
cpan/ExtUtils-MakeMaker/t/MM_Cygwin............................#
Failed test ''/c/WINDOWS/system32/cmd.exe' should be executable"'
# at t/MM_Cygwin.t line 106.
# Looks like you failed 1 test of 14.
FAILED at test 12
Since maybe_command() in MM_Cygwin.pm is hardcoded to look for
'/cygdrive', the test fails if the user changes the mount point prefix
from '/cygdrive' to something else using 'mount -c ...'. (For example,
I use 'mount -c /'.)
The attached patch fixes this finding the mount point prefix and using
it to determine if Unix or Win32 settings should be used.
Subject: | patch.txt |
--- perl-current/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm
+++ perl-current/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm
@@ -109,8 +109,25 @@
sub maybe_command {
my ($self, $file) = @_;
- if ($file =~ m{^/cygdrive/}i) {
- return ExtUtils::MM_Win32->maybe_command($file);
+ my $prefix;
+ if (defined(&Cygwin::mount_flags)) {
+ my @flags = split(/,/, Cygwin::mount_flags('/cygwin'));
+ $prefix = pop(@flags);
+ if (! $prefix || ($prefix eq 'cygdrive')) {
+ $prefix = '/cygdrive';
+ }
+ } else {
+ $prefix = '/cygdrive';
+ }
+
+ if ($prefix eq '/') {
+ if ($file =~ m{^/[a-zA-Z]/}i) {
+ return ExtUtils::MM_Win32->maybe_command($file);
+ }
+ } else {
+ if ($file =~ m{^$prefix/}i) {
+ return ExtUtils::MM_Win32->maybe_command($file);
+ }
}
return $self->SUPER::maybe_command($file);