Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The cwd.t fail, ever #13305

Open
p5pRT opened this issue Sep 24, 2013 · 5 comments
Open

The cwd.t fail, ever #13305

p5pRT opened this issue Sep 24, 2013 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Sep 24, 2013

Migrated from rt.perl.org#119965 (status was 'open')

Searchable as RT119965$

@p5pRT
Copy link
Author

p5pRT commented Sep 24, 2013

From explorer@joaquinferrero.com

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<-------------------------------------

Inline Patch
--- 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

@p5pRT
Copy link
Author

p5pRT commented Jan 26, 2014

From @jkeenan

On Mon Sep 23 18​:22​:33 2013, explorer wrote​:

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!

I've discussed this on IRC with a couple of other perlbrew users. So far I'm not persuaded that there is a bug in Cwd.pm that warrants a revision. It is more likely that there is some problem with your use of 'perlbrew'. In particular, your statement that you cannot "access" /var/home (which appears to be the directory above your home directory).

'perlbrew' is not part of the Perl 5 core distribution, so I recommend that you seek assistance elsewhere, perhaps starting at perlbrew.pl.

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented Jan 26, 2014

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jan 26, 2014

From explorer@joaquinferrero.com

El Sáb Ene 25 18​:01​:18 2014, jkeenan escribió​:

I've discussed this on IRC with a couple of other perlbrew users. So
far I'm not persuaded that there is a bug in Cwd.pm that warrants a
revision. It is more likely that there is some problem with your use
of 'perlbrew'. In particular, your statement that you cannot "access"
/var/home (which appears to be the directory above your home
directory).

'perlbrew' is not part of the Perl 5 core distribution, so I recommend
that you seek assistance elsewhere, perhaps starting at perlbrew.pl.

Thank you very much.
Jim Keenan

Hi, Jim.

The problem is when perlbrew is executed by an user (no root), and this user don't have read&exec permissions to all home subdirs (/var or /var/home), the cwd.t test failed, so, you are right​: the problem is with perlbrew.

When compiling below root user, cwd.t run Ok.

This is duplicated of https://rt.cpan.org/Ticket/Display.html?id=53008

Thanks.
JF

--
Perl Programming

@p5pRT
Copy link
Author

p5pRT commented Jan 26, 2014

From victor@vsespb.ru

2013/9/24 Joaquin Ferrero <perlbug-followup@​perl.org>​:

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

another duplicate
https://rt.cpan.org/Public/Bug/Display.html?id=47755#txn-1303596

I think _perl_abs_path should not call rel2abs, because rel2abs _can_
return unreadable (thus unexisting) directory.
and if parent directories unreadable _perl_abs_path better to return error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants