From: David E. Wheeler Date: Fri, 10 Jul 2009 17:14:39 +0000 (-0700) Subject: Fix ExtUtils::Installed failure with -Duserelocatableinc X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=69a43907343338be83348549c3ca427544e91995;p=p5sagit%2Fp5-mst-13.2.git Fix ExtUtils::Installed failure with -Duserelocatableinc 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. --- diff --git a/lib/ExtUtils/Installed.pm b/lib/ExtUtils/Installed.pm index 8e65139..727a01d 100644 --- a/lib/ExtUtils/Installed.pm +++ b/lib/ExtUtils/Installed.pm @@ -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; diff --git a/lib/ExtUtils/t/Installed.t b/lib/ExtUtils/t/Installed.t index f820ef4..dd492c2 100644 --- a/lib/ExtUtils/t/Installed.t +++ b/lib/ExtUtils/t/Installed.t @@ -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';