Fix ExtUtils::Installed failure with -Duserelocatableinc
authorDavid E. Wheeler <david@kineticode.com>
Fri, 10 Jul 2009 17:14:39 +0000 (10:14 -0700)
committerYves Orton <demerphq@gemini.(none)>
Fri, 17 Jul 2009 22:26:27 +0000 (00:26 +0200)
This patch fixes an issue with ExtUtils::Installed when Perl is compiled with
userelocatableinc. It looks a though the issue is that `%Config` contains
local paths when built with -Duserelocatableinc, some, at least, with a
leading "./". The solution is to use `File::Spec->canonpath()` to clean up the
path before comparing two paths that are otherwise the same. A better solution
might be to use some sort of other utility function that checks that paths are
the same even if they're not spelled the same. I didn't notice such a function
in File::Spec, alas.

Also, I'm not sure what effects this change might have on VMS; it deserves
further testing there.

lib/ExtUtils/Installed.pm
lib/ExtUtils/t/Installed.t

index 8e65139..727a01d 100644 (file)
@@ -16,7 +16,7 @@ my $DOSISH = ($^O =~ /^(MSWin\d\d|os2|dos|mint)$/);
 require VMS::Filespec if $Is_VMS;
 
 use vars qw($VERSION);
-$VERSION = '1.43';
+$VERSION = '1.43_1';
 $VERSION = eval $VERSION;
 
 sub _is_prefix {
@@ -28,9 +28,8 @@ sub _is_prefix {
         $path   = VMS::Filespec::unixify($path);
     }
 
-    # Sloppy Unix path normalization.
-    $prefix =~ s{/+}{/}g;
-    $path   =~ s{/+}{/}g;
+    # Unix path normalization.
+    $prefix = File::Spec->canonpath($prefix);
 
     return 1 if substr($path, 0, length($prefix)) eq $prefix;
 
index f820ef4..dd492c2 100644 (file)
@@ -45,7 +45,7 @@ ok( $ei->_is_type(0, 'all'), '_is_type() should be true for type of "all"' );
 
 foreach my $path (qw( man1dir man3dir )) {
     SKIP: {
-        my $dir = $Config{$path.'exp'};
+        my $dir = File::Spec->canonpath($Config{$path.'exp'});
         skip("no man directory $path on this system", 2 ) unless $dir;
 
         my $file = $dir . '/foo';