develooper Front page | perl.par | Postings from October 2019

[rt.cpan.org #130685] core module detection doesn't work with-Duserelocatableinc

Thread Previous
From:
Frank Lichtenheld via RT
Date:
October 10, 2019 08:37
Subject:
[rt.cpan.org #130685] core module detection doesn't work with-Duserelocatableinc
Message ID:
rt-4.0.18-27192-1570696644-780.130685-15-0@rt.cpan.org
Thu Oct 10 04:37:24 2019: Request 130685 was acted upon.
Transaction: Ticket created by Frank.Lichtenheld@Sophos.com
       Queue: PAR-Packer
     Subject: core module detection doesn't work with -Duserelocatableinc
   Broken in: 1.049
    Severity: Important
       Owner: Nobody
  Requestors: Frank.Lichtenheld@Sophos.com
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=130685 >


Hi.

If perl was compiled with -Duserelocatableinc then privlib and archlib are relative paths starting with ... which is the directory of the Perl executable. This breaks the detection of core modules.

The following patch fixed the issue for me:

diff --git a/lib/PAR/Packer.pm b/lib/PAR/Packer.pm
index 74e1414..903d61e 100644
--- a/lib/PAR/Packer.pm
+++ b/lib/PAR/Packer.pm
@@ -823,6 +823,15 @@ sub pack_manifest_hash {
 
     (my $privlib = $Config{privlib}) =~ s{\\}{/}g;
     (my $archlib = $Config{archlib}) =~ s{\\}{/}g;
+    if($Config{userelocatableinc}){
+        my $perldir = dirname($^X);
+        $privlib =~ s/^\.\.\./$perldir/;
+        $privlib = abs_path($privlib);
+        $self->_vprint(2, "relocatable privlib at $privlib");
+        $archlib =~ s/^\.\.\./$perldir/;
+        $archlib = abs_path($archlib);
+        $self->_vprint(2, "relocatable archlib at $archlib");
+    }
     foreach my $pfile (sort grep length $map{$_}, keys %map) {
         next if !$opt->{B} and (
             ($map{$pfile} eq "$privlib/$pfile") or


Regards,
  Frank

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About