Subject: Perl graft breakage

From: Leo Famulari <[email-masked]>
Date: Wed, 18 Apr 2018 14:08:50 -0400

On Sun, Apr 15, 2018 at 05:34:05PM +0200, Marius Bakke wrote:
> * gnu/packages/perl.scm (perl-5.26.2): New public variable.
> (perl)[replacement]: New field.

I noticed on my Debian system that this broke rxvt-unicode, and it
probably affects other packages as well.

The issue is that the full path of libperl.so includes the Perl version
number, for example:

/gnu/store/...-perl-5.26.1/lib/perl5/5.26.1/x86_64-linux-thread-multi/CORE/libperl.so

The RUNPATH of urxvt with the Perl graft includes this bogus path:

/gnu/store/ynk3rg3i791i6k7rz2imbyj9wyfjrnrc-perl-5.26.2/lib/perl5/5.26.1/x86_64-linux-thread-multi/CORE

Grafting fails to replace the latter instance of the version number,
and so lookups fail like this:

------
[...]
openat(AT_FDCWD, "/gnu/store/4sqaib7c2dfjv62ivrg9b8wa7bh226la-glibc-2.26.105-g0890d5379c/lib/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/95b2fv709zvxdrb38l2w8jd73vz5v5ff-fontconfig-2.12.6/lib/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/4pj266bvxiris0vbvm1j568n1smdj7m8-freetype-2.8.1/lib/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/6n2pn58p6l7v9icg0m3i8kp4wbn8nzl2-libxft-2.3.2/lib/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/7lm90jgm2y00382yqriq4yw1nvb3p7b6-libxrender-0.9.10/lib/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/6x1p96h51dlgpdsmrx3821ixbawbm19l-libx11-1.6.5/lib/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../../tls/x86_64/x86_64/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../../tls/x86_64/x86_64", 0x7ffd43384b10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../../tls/x86_64/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../../tls/x86_64", 0x7ffd43384b10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../../tls/x86_64/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../../tls/x86_64", 0x7ffd43384b10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../../tls/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../../tls", 0x7ffd43384b10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../../x86_64/x86_64/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../../x86_64/x86_64", 0x7ffd43384b10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../../x86_64/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../../x86_64", 0x7ffd43384b10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../../x86_64/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../../x86_64", 0x7ffd43384b10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../../libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/gnu/store/2ifmksc425qcysl5rkxkbv6yrgc1w9cs-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../..", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0
openat(AT_FDCWD, "/gnu/store/4sqaib7c2dfjv62ivrg9b8wa7bh226la-glibc-2.26.105-g0890d5379c/lib/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
writev(2, [{iov_base="urxvt", iov_len=5}, {iov_base=": ", iov_len=2}, {iov_base="error while loading shared libra"..., iov_len=36}, {iov_base=": ", iov_len=2}, {iov_base="libperl.so", iov_len=10}, {iov_base=": ", iov_len=2}, {iov_base="cannot open shared object file", iov_len=30}, {iov_base=": ", iov_len=2}, {iov_base="No such file or directory", iov_len=25}, {iov_base="\n", iov_len=1}], 10urxvt: error while loading shared libraries: libperl.so: cannot open shared object file: No such file or directory
) = 115
exit_group(127)                         = ?
------