develooper Front page | perl.perl5.porters | Postings from October 2014

[perl #123042] Fix for RT#113422 is buggy and needs to be fixed for inaccesible directories (like PERL5LIB)

Thread Next
October 24, 2014 13:21
[perl #123042] Fix for RT#113422 is buggy and needs to be fixed for inaccesible directories (like PERL5LIB)
Message ID:
# New Ticket Created by   
# Please include the string:  [perl #123042]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from,
generated with the help of perlbug 1.40 running under perl 5.20.0.

[Please describe your issue here]

I'm copying the original report from Luciano Rocha in RT#113422
here (see the additions after that as well):

We were bitten by this fix.

The description didn't help finding the reason of the error:
-sh-4.1$ /usr/local/booking-perl/5.18.2/bin/perl5.18.2 -e 'print "@INC\n"'
/usr/local/git_tree/main/lib /usr/local/booking-perl/5.18.2/site/lib /usr/local/booking-perl/5.18.2/lib .

-sh-4.1$ /usr/local/booking-perl/5.18.2/bin/perl5.18.2 -e 'use warnings; print "@INC\n"'
Can't locate   Permission denied at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

-sh-4.1$ ls -l /usr/local/booking-perl/5.18.2/lib/ 
-r--r--r-- 1 root root 20624 Jan 28  2014 /usr/local/booking-perl/5.18.2/lib/

The problem was having a directory in PERL5LIB that had the wrong permissions.

Test case:
$ PERL5LIB=/root /usr/local/booking-perl/5.18.2/bin/perl5.18.2 -e 'use warnings; print "@INC\n"'
Can't locate   Permission denied at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
$ PERL5LIB=/root /usr/local/booking-perl/5.14.2/bin/perl5.14.2 -e 'use warnings; print "@INC\n"'
/root /usr/local/booking-perl/5.14.2/site/lib /usr/local/booking-perl/5.14.2/lib .

So perl isn't distinguishing from "no permission to read file" and "no permission to access a component in @INC".

Could the fix be changed to only report on file permissions, or make the error more informative (include the path that gave the error, not just the module name)?


Note that the fix done in RT#113422 will also trigger that fatal error even with a simple version check:

ml97053:~ bgursoy$ mkdir /tmp/test && sudo chmod 0600  /tmp/test && sudo chown root /tmp/test
ml97053:~ bgursoy$ PERL5LIB=/tmp/test perl -V:version
Can't locate   Permission denied.
BEGIN failed--compilation aborted.

This error is cryptic, misleading and not helpful.

The directory checks should only emit a warning and fall back to the regular program flow.

Also note that such a directory can also be empty

[Please do not change anything below this line]
Site configuration information for perl 5.20.0:

Configured by bgursoy at Fri Sep 12 15:16:03 CEST 2014.

Summary of my perl5 (revision 5 version 20 subversion 0) configuration:
    osname=darwin, osvers=13.3.0, archname=darwin-2level
    uname='darwin ml97053 13.3.0 darwin kernel version 13.3.0: tue jun 3 21:27:35 pdt 2014; root:xnu-2422.110.17~1release_x86_64 x86_64 '
    config_args='-Dprefix=/Users/bgursoy/.plenv/versions/5.20.0 -de -Dusedevel -A'eval:scriptdir=/Users/bgursoy/.plenv/versions/5.20.0/bin''
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include',
    cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include'
    ccversion='', gccversion='4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)', 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='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib -L/opt/local/lib'
    libpth=/Applications/ /Applications/ /Applications/ /usr/local/lib /opt/local/lib /usr/lib
    libs=-ldbm -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=, so=dylib, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector'

@INC for perl 5.20.0:

Environment for perl 5.20.0:
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)

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