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

[perl #32406] abs_path in Cwd 3.01 fails for any path when . is unreadable.

From:
Steve Peters via RT
Date:
September 25, 2005 20:46
Subject:
[perl #32406] abs_path in Cwd 3.01 fails for any path when . is unreadable.
Message ID:
rt-3.0.11-32406-121422.14.0869606852745@perl.org
> [chrekh.rsv - Thu Nov 11 02:02:35 2004]:
> 
> This is a bug report for perl from chrekh@rsv.se,
> generated with the help of perlbug 1.35 running under perl v5.8.5.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> Cwd::abs_path from Cwd 3.01 returns undef even for valid readable
> paths when . is not readable.
> 
> Steps to reproduce:
> 
> 1) as root, make a test-directory readable for root only.
> 2) cd to that dir
> 3) run the following test-script with 'su user -c script'
> 
> ----------------------------------------------------------
> use strict;
> use warnings;
> 
> use Cwd qw/ &abs_path /;
> 
> print $Cwd::VERSION,"\n";
> 
> my $some_dir = abs_path('/var/spool');
> 
> print "$some_dir\n";
> ----------------------------------------------------------
> 
> The result I get is:
> 
> # mkdir /tmp/foo
> # cd /tmp/foo
> # chmod og-r .
> # ls -ld .
> drwx--x--x   2 root       bin             96 nov 11 10:44 ./
> # ~chrekh/tmp/test.pl
> 3.01
> /var/spool
> # su chrekh -c ~chrekh/tmp/test.pl
> 3.01
> Use of uninitialized value in concatenation (.) or string at
>    /home/u30003/chrekh/tmp/test.pl line 12.
> 
>

I am able to replicate this bug with Cwd 3.11.

root@kirk:/tmp/foo # su steve -c perl ../foo.pl
3.11
Use of uninitialized value in concatenation (.) or string at ../foo.pl
line 10.






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