Skip to content

Unshifting incorrect/old lib dirs onto @INC #88

@castaway

Description

@castaway

I have been trying to install Convos, one of the deps is File::Remove, which uses Module::Build. I'm running this using the convos installer, which runs cpanm for each of the deps, which does its usual magic. Something was failing when installing File::Remove, as something was looking for an .so file in the wrong lib dir (in 5.30.3 dirs, not in 5.32 dirs)

NB: I had the same issue for some of the other dependencies, if I install them manually using cpanm on the command line, then they install .. via the script, they didn't. This one I decided to try and poke into why. (Until after various runs with debugging in Module::Build::Base, it did then magically install... )

Caveat - yes my perl -V has stuff in its @inc from previous versions, this is generally fine as perl reads them in order, and the old stuff is at the bottom. Why, I dunno, this is a gentoo system Perl.

perl -V:

  Built under linux
  Compiled at May 27 2021 16:13:00
  @INC:
    /etc/perl
    /usr/local/lib64/perl5/5.32/x86_64-linux-thread-multi
    /usr/local/lib64/perl5/5.32
    /usr/lib64/perl5/vendor_perl/5.32/x86_64-linux-thread-multi
    /usr/lib64/perl5/vendor_perl/5.32
    /usr/lib64/perl5/5.32/x86_64-linux-thread-multi
    /usr/lib64/perl5/5.32
    /usr/lib64/perl5/5.30.3
    /usr/lib64/perl5/vendor_perl/5.30.3
    /usr/local/lib64/perl5/5.30.3
    /usr/lib64/perl5/vendor_perl/5.30.1
    /usr/local/lib64/perl5/5.30.1
    /usr/lib64/perl5/vendor_perl/5.28.2

Error (with strace):

stat("/mnt/allthespace/usrsrc/extern/convos/local/lib/perl5/x86_64-linux-thread-multi/Encode.pmc", 0x7ffdfcc23620) = -1 ENOENT (No such file or directory)
stat("/mnt/allthespace/usrsrc/extern/convos/local/lib/perl5/x86_64-linux-thread-multi/Encode.pm", 0x7ffdfcc23620) = -1 ENOENT (No such file or directory)
stat("/mnt/allthespace/usrsrc/extern/convos/local/lib/perl5/Encode.pmc", 0x7ffdfcc23620) = -1 ENOENT (No such file or directory)
stat("/mnt/allthespace/usrsrc/extern/convos/local/lib/perl5/Encode.pm", 0x7ffdfcc23620) = -1 ENOENT (No such file or directory)
stat("/mnt/allthespace/usrsrc/extern/convos/lib/Encode.pmc", 0x7ffdfcc23620) = -1 ENOENT (No such file or directory)
stat("/mnt/allthespace/usrsrc/extern/convos/lib/Encode.pm", 0x7ffdfcc23620) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib64/perl5/5.30.3/x86_64-linux-thread-multi/Encode.pmc", 0x7ffdfcc23620) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib64/perl5/5.30.3/x86_64-linux-thread-multi/Encode.pm", {st_mode=S_IFREG|0444, st_size=32083, ...}) = 0
openat(AT_FDCWD, "/usr/local/lib64/perl5/5.30.3/x86_64-linux-thread-multi/Encode.pm", O_RDONLY|O_CLOEXEC) = 4
ioctl(4, TCGETS, 0x7ffdfcc233d0)        = -1 ENOTTY (Inappropriate ioctl for device)
lseek(4, 0, SEEK_CUR)                   = 0
read(4, "#\n# $Id: Encode.pm,v 3.06 2020/0"..., 8192) = 8192
stat("/usr/local/lib64/perl5/5.30.3/x86_64-linux-thread-multi/auto/Encode/Encode.so", {st_mode=S_IFREG|0555, st_size=54544, ...}) = 0
stat("/usr/local/lib64/perl5/5.30.3/x86_64-linux-thread-multi/auto/Encode/Encode.bs", 0x55ef5ed004b8) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/lib64/perl5/5.30.3/x86_64-linux-thread-multi/auto/Encode/Encode.so", O_RDONLY|O_CLOEXEC) = 5

Encode.c: loadable library and perl binaries are mismatched (got handshake key 0xcd00080, needed 0xed00080)

Assumption: this is because Module::Build unshifts some dirs onto @inc, one of them is the OLD dir for the Encode.pm/.so files:

  unshift @INC,
    (
     '/mnt/allthespace/usrsrc/extern/convos/local/lib/perl5/x86_64-linux-thread-multi',
     '/mnt/allthespace/usrsrc/extern/convos/local/lib/perl5',
     '/mnt/allthespace/usrsrc/extern/convos/lib',
     '/usr/local/lib64/perl5/5.30.3/x86_64-linux-thread-multi',
     '/usr/local/lib64/perl5/5.30.1/x86_64-linux-thread-multi'
    );

From I assume here:

my @myINC = $self->_added_to_INC;
for (@myINC, values %q) {
$_ = File::Spec->canonpath( $_ ) unless $self->is_vmsish;
s/([\\\'])/\\$1/g;
}

Reading it (and dumping the @inc and the inc from _default_inc) (why would they be different!?) is as far as I got before the universe decided it would play after all...

There definitely is an Encode in the 5.32 dirs, it just doesn't get found first when using Module::Build (sometimes!) Makefile.PL based dists seem fine..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions