perl5
perl5 copied to clipboard
$Config{perlpath} is incorrect for relocatable perl
From @dmcbride
Created by @dmcbride
If I use a relocatable perl (-Duserelocatableinc), $Config::Config{perlpath} is incorrect. I'm not sure if this is by design or merely an oversight.
If it's by design, the documentation for Config may need to call this out as something that should not be used for relocatable perls (and to use $^X instead).
If it's an oversight, the following patch seems sufficient. It at least gets Proc::FastSpawn to test/install successfully, which is where I first encountered this issue.
Inline Patch
diff --git a/Configure b/Configure
index 071b5ec..b0e4bba 100755
--- a/Configure
+++ b/Configure
@@ -8939,8 +8939,8 @@ echo "I'll use $startperl to start perl scripts."
case "$perlpath" in
'')
case "$versiononly" in
- "$define") perlpath="$initialinstalllocation/perl$version";;
- *) perlpath="$initialinstalllocation/perl";;
+ "$define") perlpath="${binexp}perl$version";;
+ *) perlpath="${binexp}perl";;
esac
case "$startperl" in
*!*) ;;
diff --git a/configpm b/configpm
index fbc4710..cfbf2c3 100755
--- a/configpm
+++ b/configpm
@@ -436,6 +436,7 @@ if (fetch_string({},'userelocatableinc')) {
man1direxp
man3direxp
privlibexp
+ perlpath
scriptdirexp
sitearchexp
sitebinexp
Perl Info
Flags:
category=library
severity=low
module=Config
Site configuration information for perl 5.19.7:
Configured by dmcbride at Mon Nov 25 11:21:52 MST 2013.
Summary of my perl5 (revision 5 version 19 subversion 7) configuration:
Derived from: ea5eb3d3ca6e00870adfc543a2364826e1c0f77e
Platform:
osname=linux, osvers=3.11.6-gentoo, archname=x86_64-linux-thread-multi
uname='linux naboo 3.11.6-gentoo #1 smp fri nov 1 15:30:00 mdt 2013 x86_64 intel(r) core(tm) i7 cpu 930 @ 2.80ghz genuineintel gnulinux '
config_args='-desr -Duse64bitall -Duselongdoubles -Dusethreads -Dprefix=/home/dmcbride/perl/blead -Dusedevel -Duserelocatableinc'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector'
ccversion='', gccversion='4.7.3', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
libpth=/usr/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc -lgdbm_compat
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.15.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.15'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'
Locally applied patches:
uncommitted-changes
@INC for perl 5.19.7:
/home/dmcbride/tmp/blead-perl/home/dmcbride/perl/blead/lib/site_perl/5.19.7/x86_64-linux-thread-multi
/home/dmcbride/tmp/blead-perl/home/dmcbride/perl/blead/lib/site_perl/5.19.7
/home/dmcbride/tmp/blead-perl/home/dmcbride/perl/blead/lib/5.19.7/x86_64-linux-thread-multi
/home/dmcbride/tmp/blead-perl/home/dmcbride/perl/blead/lib/5.19.7
.
Environment for perl 5.19.7:
HOME=/home/dmcbride
LANG=en_US.utf8
LANGUAGE=
LC_ALL=en_US.utf8
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/dmcbride/bin:/usr/lib/distcc/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3:/usr/x86_64-pc-linux-gnu/i686-pc-linux-gnu/gcc-bin/4.6.3:/opt/android-sdk-update-manager/tools:/opt/android-sdk-update-manager/platform-tools:/opt/nvidia-cg-toolkit/bin:/share/cvs/bin:/usr/local/bin:/usr/games/bin:/share/bin:/share/darin/bin
PERL_BADLANG (unset)
SHELL=/bin/bash
From [email protected]
On 11/25/2013 12:07 PM, Darin McBride (via RT) wrote:
If I use a relocatable perl (-Duserelocatableinc), $Config::Config{perlpath} is incorrect. I'm not sure if this is by design or merely an oversight.
Andreas Koenig and I both ran into similar issues with relocatable inc and reported on them here: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=112448
This new ticket should probably be merged with the older one above.
The usefulness of userelocatableinc is greatly reduced by things like perlpath not being relative.
The RT System itself - Status changed from 'new' to 'open'
From @Leont
On Mon, Nov 25, 2013 at 9:07 PM, Darin McBride <perlbug-followup@perl.org>wrote:
If I use a relocatable perl (-Duserelocatableinc), $Config::Config{perlpath} is incorrect. I'm not sure if this is by design or merely an oversight.
If it's by design, the documentation for Config may need to call this out as something that should not be used for relocatable perls (and to use $^X instead).
If it's an oversight, the following patch seems sufficient. It at least gets Proc::FastSpawn to test/install successfully, which is where I first encountered this issue.
I've previously used perlpath as an untainted source of perl's location. On relocatable perls this answer is often wrong (but I'm checking for that, so that's ok) but always untainted. The new behavior is more likely to be correct, but tainted on relocatable perls. It would seem using $Config{initialinstalllocation} offers a way around this.
Not saying this is a bad trade-off, but it should be documented.
Likewise, what should we do about startperl? Currently, scripts on relocatable perls are rather problematic, the turtles don't go all the way down. This needs to be solved somewhere between Configure and the toolchain.
Leon
Why we do not expand $Config{'binexp'} but sitebinexp (and all other *site*)? https://github.com/Perl/perl5/blob/12bfaf55b1cd5d72a7381be53a14e480fa3e70da/configpm#L368-L379