summaryrefslogtreecommitdiff
path: root/t/op
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-09-21 14:32:58 +0200
committerNicholas Clark <nick@ccl4.org>2011-09-27 22:23:10 +0200
commit2982a345b7a1edb63720282eef0fba5c61d0e6b5 (patch)
tree8fffd4f1ff976c438b5e9028adba2364cca3b07d /t/op
parent2480ae1c1b2fa11085b45f96de55cb16c3bcc343 (diff)
downloadperl-2982a345b7a1edb63720282eef0fba5c61d0e6b5.tar.gz
Where available, use sysctl() with KERN_PROC_PATHNAME to make $^X absolute.
In Configure, check whether sysctl() and KERN_PROC_PATHNAME can be used to find the absolute pathname of the executable. If so, set usekernprocpathname in config.sh and USE_KERN_PROC_PATHNAME in config.h. If this is set, then use this approach in S_set_caret_X() to canonicalise $^X as an absolute path. This approach works on (at least) FreeBSD, and doesn't rely on the /proc filesystem existing, or /proc/curproc/file being present.
Diffstat (limited to 't/op')
-rw-r--r--t/op/magic.t5
1 files changed, 3 insertions, 2 deletions
diff --git a/t/op/magic.t b/t/op/magic.t
index dd6d28e1bd..5569154fcd 100644
--- a/t/op/magic.t
+++ b/t/op/magic.t
@@ -230,10 +230,11 @@ $$ = $pid; # Tests below use $$
# $^X and $0
{
+ my $is_abs = $Config{d_procselfexe} || $Config{usekernprocpathname};
if ($^O eq 'qnx') {
chomp($wd = `/usr/bin/fullpath -t`);
}
- elsif($Is_Cygwin || $Config{'d_procselfexe'}) {
+ elsif($Is_Cygwin || $is_abs) {
# Cygwin turns the symlink into the real file
chomp($wd = `pwd`);
$wd =~ s#/t$##;
@@ -248,7 +249,7 @@ $$ = $pid; # Tests below use $$
else {
$wd = '.';
}
- my $perl = $Is_VMS || $Config{d_procselfexe} ? $^X : "$wd/perl";
+ my $perl = $Is_VMS || $is_abs ? $^X : "$wd/perl";
my $headmaybe = '';
my $middlemaybe = '';
my $tailmaybe = '';