develooper Front page | perl.perl5.porters | Postings from September 2011

Re: [perl #93134] Relocatable-perl on AIX does not run if added toPATH

Thread Previous | Thread Next
Nicholas Clark
September 28, 2011 03:43
Re: [perl #93134] Relocatable-perl on AIX does not run if added toPATH
Message ID:
On Mon, Jun 20, 2011 at 04:59:33PM -0700, Jan Dubois wrote:
> On Mon, 20 Jun 2011, via RT wrote:
> > If I compile perl 5.14.0 with -Duserelocatableinc, and then relocate
> > it afterward and add that to the PATH, "perl -V" doesn't find
> > and thus dies.
> [...]
> > When I try this on Linux, it works.  I suspect it has something to do with:
> > 
> > $ perl -le 'print $^X'
> > perl
> > 
> > whereas if I do the same thing on Linux, I get a full path to perl in the
> > relocated directory (not where it was compiled to install to).  If I call
> > the perl on AIX with a full or relative path, it works fine.
> That is indeed the problem: -Duserelocatableinc really only works on Linux
> where $^X is set from /proc/self/exe.  On other systems it just relies on the
> value of argv[0], which is typically not fully qualified.
> I know how to make things work on OS X and Solaris as well, but for AIX
> and HP-UX I don't know of any secure/reliable mechanism to determine
> the full path of the currently running executable.

With commit 6f31bef90fda3b9a I've merged code to make $^X absolute on OS X,
Solaris 10 and 11, and FreeBSD without needing /proc mounted.

It would be possible to use getexecname() along with realpath() on earlier
Solaris, but I'm not sure if it's worth adding.

perl already uses /proc on Linux and NetBSD to convert $^X to an absolute

Like Jan, I'm not aware of a reliable way to do this on any other platform.
Likely it's not possible.

Nicholas Clark

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About