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

[perl #119965] The cwd.t fail, ever

Thread Next
From:
Joaquin Ferrero
Date:
September 24, 2013 01:22
Subject:
[perl #119965] The cwd.t fail, ever
Message ID:
rt-3.6.HEAD-1873-1379985753-1016.119965-75-0@perl.org
# New Ticket Created by  Joaquin Ferrero 
# Please include the string:  [perl #119965]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=119965 >



This is a bug report for perl from explorer@joaquinferrero.com,
generated with the help of perlbug 1.39 running under perl 5.18.0.


-----------------------------------------------------------------
Hi!

I use perlbrew to install perls. And all installations show the same message:

#   Failed test at t/cwd.t line 209.
#                   '/var/home/explorer/perl5/perlbrew/build/perl-5.19.4/dist/Cwd/t/linktest'
#     doesn't match '(?^i:\/var\/home\/explorer\/perl5\/perlbrew\/build\/perl\-5\.19\.4\/dist\/Cwd\/t\/_ptrslt_\/_path_\/_to_\/_a_\/_dir_$)'


The problem is here: this is the 25th test of cwd.t:
--------------------------8<-------------------------------------
209:    like(Cwd::_perl_abs_path($file), qr|$want$|i) if $EXTRA_ABSPATH_TESTS
--------------------------8<-------------------------------------

and Cwd::_perl_abs_path($file) fail, because I don't have permissions to access the /var/home/ directory:
--------------------------8<-------------------------------------
581         unless (opendir(PARENT, $dotdots))
582         {
583             # probably a permissions issue.  Try the native command.
584             require File::Spec;
585             return File::Spec->rel2abs( $start, _backtick_pwd() );
586         }
--------------------------8<-------------------------------------

Cwd::_perl_abs_path() call File::Spec->rel2abs(), but $start is the path to the symlink:

    '/var/home/explorer/perl5/perlbrew/build/perl-5.19.4/dist/Cwd/t/linktest'

not the real path:

    '/var/home/explorer/perl5/perlbrew/build/perl-5.19.4/dist/Cwd/t/_ptrslt_/_path_/_to_/_a_/_dir_'

so, the test fail.


I found a solution (not sure if the best, of course):
--------------------------8<-------------------------------------
--- lib/Cwd.pm~ 2013-08-17 18:17:24.000000000 +0200
+++ lib/Cwd.pm  2013-09-24 00:58:56.000000000 +0200
@@ -582,6 +582,7 @@
        {
            # probably a permissions issue.  Try the native command.
            require File::Spec;
+            $start = readlink($start) if -l $start;
            return File::Spec->rel2abs( $start, _backtick_pwd() );
        }
        unless (@cst = stat($dotdots))
--------------------------8<-------------------------------------

readlink() resolves the symlink, so the test work, and I can install a new perl, with no force.

Bye!

-----------------------------------------------------------------
---
Flags:
    category=install
    severity=medium
---
Site configuration information for perl 5.18.0:

Configured by explorer at Sun May 19 20:24:27 CEST 2013.

Summary of my perl5 (revision 5 version 18 subversion 0) configuration:
   
  Platform:
    osname=linux, osvers=3.2.13-grsec-xxxx-grs-ipv6-64, archname=x86_64-linux
    uname='linux ks201440 3.2.13-grsec-xxxx-grs-ipv6-64 #1 smp thu mar 29 09:48:59 utc 2012 x86_64 gnulinux '
    config_args='-de -Dprefix=/home/explorer/perl5/perlbrew/perls/perl-5.18.0 -Aeval:scriptdir=/home/explorer/perl5/perlbrew/perls/perl-5.18.0/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.7.2', 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='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.13'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'

Locally applied patches:
    

---
@INC for perl 5.18.0:
    /home/explorer/perl5/perlbrew/perls/perl-5.18.0/lib/site_perl/5.18.0/x86_64-linux
    /home/explorer/perl5/perlbrew/perls/perl-5.18.0/lib/site_perl/5.18.0
    /home/explorer/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux
    /home/explorer/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0
    .

---
Environment for perl 5.18.0:
    HOME=/home/explorer
    LANG=es_ES.UTF-8
    LANGUAGE=es:en
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/explorer/bin:/home/explorer/perl5/perlbrew/bin:/home/explorer/perl5/perlbrew/perls/perl-5.18.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
    PERLBREW_BASHRC_VERSION=0.63
    PERLBREW_HOME=/home/explorer/.perlbrew
    PERLBREW_MANPATH=/home/explorer/perl5/perlbrew/perls/perl-5.18.0/man
    PERLBREW_PATH=/home/explorer/perl5/perlbrew/bin:/home/explorer/perl5/perlbrew/perls/perl-5.18.0/bin
    PERLBREW_PERL=perl-5.18.0
    PERLBREW_ROOT=/home/explorer/perl5/perlbrew
    PERLBREW_VERSION=0.63
    PERLDOC_POD2=1
    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