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

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

Thread Previous
From:
James E Keenan via RT
Date:
January 26, 2014 02:01
Subject:
[perl #119965] The cwd.t fail, ever
Message ID:
rt-4.0.18-5304-1390701678-1122.119965-15-0@perl.org
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

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=119965

Thread Previous


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