This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
avoid infinite recursion in _perl_abs_path()
authorZefram <zefram@fysh.org>
Tue, 26 Dec 2017 07:46:35 +0000 (07:46 +0000)
committerZefram <zefram@fysh.org>
Tue, 26 Dec 2017 07:46:35 +0000 (07:46 +0000)
If _perl_abs_path() couldn't opendir("..") then it would call
File::Spec->rel2abs, which was liable to call back to Cwd::getcwd() and
thus to _perl_abs_path(), producing an infinite recursion.  The call to
File::Spec->rel2abs is of dubious value anyway, so just turn that into
an error return.  Fixes [perl #132651].

dist/PathTools/Cwd.pm
dist/PathTools/t/cwd_enoent.t

index d6c65e9..c648a57 100644 (file)
@@ -421,9 +421,7 @@ sub _perl_abs_path
        local *PARENT;
        unless (opendir(PARENT, $dotdots))
        {
-           # probably a permissions issue.  Try the native command.
-           require File::Spec;
-           return File::Spec->rel2abs( $start, _backtick_pwd() );
+           return undef;
        }
        unless (@cst = stat($dotdots))
        {
index 9980dfd..59e3612 100644 (file)
@@ -1,8 +1,6 @@
 use warnings;
 use strict;
 
-use Test::More skip_all => "infinite loop seen on FreeBSD [perl #132651]";
-
 use Config;
 use Errno qw(ENOENT);
 use File::Temp qw(tempdir);