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
From:
perlbug-followup
Date:
October 24, 2014 13:21
Subject:
[perl #123042] Fix for RT#113422 is buggy and needs to be fixed for inaccesible directories (like PERL5LIB)
Message ID:
rt-4.0.18-31808-1414150764-1339.123042-75-0@perl.org
# New Ticket Created by   
# Please include the string:  [perl #123042]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=123042 >



This is a bug report for perl from burak@cpan.org,
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 warnings.pm:   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/warnings.pm 
-r--r--r-- 1 root root 20624 Jan 28  2014 /usr/local/booking-perl/5.18.2/lib/warnings.pm

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 warnings.pm:   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)?

Regards.
"

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 Config.pm:   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]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
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:
   
  Platform:
    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
  Compiler:
    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include',
    optimize='-O3',
    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/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib /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
    gnulibc_version=''
  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:
    /Users/bgursoy/.plenv/versions/5.20.0/lib/perl5/site_perl/5.20.0/darwin-2level
    /Users/bgursoy/.plenv/versions/5.20.0/lib/perl5/site_perl/5.20.0
    /Users/bgursoy/.plenv/versions/5.20.0/lib/perl5/5.20.0/darwin-2level
    /Users/bgursoy/.plenv/versions/5.20.0/lib/perl5/5.20.0
    .

---
Environment for perl 5.20.0:
    DYLD_LIBRARY_PATH (unset)
    HOME=/Users/bgursoy
    LANG (unset)
    LANGUAGE (unset)
    LC_CTYPE=UTF-8
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/Users/bgursoy/.plenv/versions/5.20.0/bin:/Users/bgursoy/.plenv/libexec:/Users/bgursoy/.plenv/plugins/perl-build/bin:/opt/local/bin:/opt/local/sbin:/Users/bgursoy/.plenv/shims:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin:/Users/bgursoy/bin:~/.plenv/bin:/opt/burak/prog/bin
    PERLCRITIC=/Users/bgursoy/projects/CPAN/tools/builder/.perlcriticrc
    PERL_BADLANG (unset)
    SHELL=/bin/bash


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