develooper Front page | perl.perl5.porters | Postings from April 2013

[perl #117751] POSIX::AUTOLOAD can endlessly recurse on itself

Thread Next
From:
Brian Fraser
Date:
April 24, 2013 22:44
Subject:
[perl #117751] POSIX::AUTOLOAD can endlessly recurse on itself
Message ID:
rt-3.6.HEAD-28177-1366843416-1623.117751-75-0@perl.org
# New Ticket Created by  Brian Fraser 
# Please include the string:  [perl #117751]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=117751 >


This is a bug report for perl from fraserbn@gmail.com,
generated with the help of perlbug 1.39 running under perl 5.17.12.

-----------------------------------------------------------------
[Please describe your issue here]

I'm mostly reporting this out of completeness, since I don't think that it
really requires fixing.

When cross-compiling Perl, it's possible that an extension compiles
successfully but can't be used in the target system due to linking issues;
In Android, this looks something like this:

$ LD_LIBRARY_PATH=/mnt/asec/perl:/mnt/asec/perl/lib:/mnt/asec/perl/lib/auto
./perl -I../lib -MPOSIX -e1
Can't load '../lib/auto/POSIX/POSIX.so' for module POSIX:
Cannot load library: link_image[1995]: failed to link POSIX.so
    at ../lib/POSIX.pm line 36.

The above can cause POSIX::AUTOLOAD to recurse infinitely (and eventually
crash the device, namely, my phone), for example in t/run/exit.t, which
does this:

  my $posix_ok = eval { require POSIX; };
  my $wait_macros_ok = defined &POSIX::WIFEXITED;
  eval { POSIX::WIFEXITED(${^CHILD_ERROR_NATIVE}) };

The solution is having a properly linked POSIX.so :D
Perhaps POSIX::AUTOLOAD should detect this, somehow, and bail out?

As a side note, in case someone googling the error above gets here: I
resolved it by copying over the libraries in the device's /system/lib and
pointing libpth to those.

(The data below is from the affected system, but wasn't generated by
perlbug)

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=low
    module=POSIX
---
Site configuration information for perl 5.17.2

Summary of my perl5 (revision 5 version 17 subversion 12) configuration:
  Derived from: 3517a31d6d6a5b566419c6b5eb89ac4167fb0c44
  Platform:
    osname=linux-androideabi, osvers=, archname=linux-androideabi
    uname='linux naw 3.5.0-27-generic #46-ubuntu smp mon mar 25 19:58:17
utc 2013 x86_64 x86_64 x86_64 gnulinux '
    config_args='-des -Dusedevel -DDEBUGGING -Dusecrosscompile
-Dcc=arm-linux-androideabi-gcc -Dtargethost=N720_Claro
-Dsysroot=/tmp/my-toolchain/sysroot -Dtargetdir=/mnt/asec/perl'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=y, bincompat5005=undef
  Compiler:
    cc='arm-linux-androideabi-gcc', ccflags
='--sysroot=/tmp/my-toolchain/sysroot -DDEBUGGING -I/usr/local/include',
    optimize='-O -g',
    cppflags='--sysroot=/tmp/my-toolchain/sysroot -DDEBUGGING
-I/usr/local/include'
    ccversion='', gccversion='4.6 20120106 (prerelease)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='arm-linux-androideabi-gcc', ldflags ='
--sysroot=/tmp/my-toolchain/sysroot'
    libpth=/tmp/androidlib
    libs=-ldl -lm -lc
    perllibs=-ldl -lm -lc
    libc=/tmp/my-toolchain/sysroot/usr/lib/libc.so, so=so,
useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags=' --sysroot=/tmp/my-toolchain/sysroot', lddlflags='-shared
-O -g --sysroot /tmp/my-toolchain/sysroot'


Characteristics of this binary (from libperl):
  Compile-time options: DEBUGGING HAS_TIMES MYMALLOC PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
                        PERL_PRESERVE_IVUV PERL_SAWAMPERSAND PERL_USE_DEVEL
                        USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF
  Locally applied patches:
    uncommitted-changes
  Built under linux-androideabi
  Compiled at Apr 24 2013 14:26:21
  @INC:
    ../lib
    /mnt/asec/perl/lib/perl5/site_perl/5.17.12/linux-androideabi
    /mnt/asec/perl/lib/perl5/site_perl/5.17.12
    /mnt/asec/perl/lib/perl5/5.17.12/linux-androideabi
    /mnt/asec/perl/lib/perl5/5.17.12
    .

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About