develooper Front page | perl.perl5.porters | Postings from July 2009

[PATCH] Fix ExtUtils::Installed failure with -Duserelocatableinc

Thread Previous | Thread Next
David E. Wheeler
July 10, 2009 10:15
[PATCH] Fix ExtUtils::Installed failure with -Duserelocatableinc
Message ID:
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
another testing there.

And finally, there appears to be another failure, not fixed in this patch,
that I haven't been able to track down:

    lib/ExtUtils/t/INST_PREFIX....................................#   Failed test '$(SITEPREFIX) + sitearch'
    #   at ../lib/ExtUtils/t/INST_PREFIX.t line 142.
    #                   './../lib/site_perl/5.10.0/darwin-thread-multi-2level'
    #     doesn't match '(?-xism:^\$\(SITEPREFIX\))'
    FAILED at test 19

This is also likely due to relative paths in `%Config`, but I'm pretty
clueless about what that test is trying to do, as
'./../lib/site_perl/5.10.0/darwin-thread-multi-2level' comes from an
ExtUtils::MakeMaker object, and while it seems relevant, I can't imagine why
the test would be expecting something to look like a shell variable there.
Could it be an ExtUtils::MakeMaker issue? Or is INST_PREFIX just wrong to
think that such a variable will be there when Perl is built with
-Duserelocatableinc? I have no idea, but someone needs to look more closely at
the ramifications of -Duserelocatableinc, I think.
 lib/ExtUtils/  |    5 ++---
 lib/ExtUtils/t/Installed.t |    2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/lib/ExtUtils/ b/lib/ExtUtils/
index 8e65139..a6de311 100644
--- a/lib/ExtUtils/
+++ b/lib/ExtUtils/
@@ -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';

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About