a62a59a
From 8508806268d1abe6c533393333ad151e12adfc2d Mon Sep 17 00:00:00 2001
a62a59a
From: Slaven Rezic <srezic@cpan.org>
a62a59a
Date: Wed, 3 Oct 2018 10:07:32 -0400
a62a59a
Subject: [PATCH] Accept also ESTALE (fix for RT #133534)
a62a59a
MIME-Version: 1.0
a62a59a
Content-Type: text/plain; charset=UTF-8
a62a59a
Content-Transfer-Encoding: 8bit
a62a59a
a62a59a
ESTALE may occur in some environments when accessing a
a62a59a
now non-existing directory, e.g. when using NFS or in docker
a62a59a
containers.
a62a59a
a62a59a
Signed-off-by: Petr Písař <ppisar@redhat.com>
a62a59a
---
a62a59a
 dist/PathTools/t/cwd_enoent.t | 9 ++++++---
a62a59a
 1 file changed, 6 insertions(+), 3 deletions(-)
a62a59a
a62a59a
diff --git a/dist/PathTools/t/cwd_enoent.t b/dist/PathTools/t/cwd_enoent.t
a62a59a
index 8f3a1fb1fb..510c65ed0c 100644
a62a59a
--- a/dist/PathTools/t/cwd_enoent.t
a62a59a
+++ b/dist/PathTools/t/cwd_enoent.t
a62a59a
@@ -2,7 +2,7 @@ use warnings;
a62a59a
 use strict;
a62a59a
 
a62a59a
 use Config;
a62a59a
-use Errno qw(ENOENT);
a62a59a
+use Errno qw();
a62a59a
 use File::Temp qw(tempdir);
a62a59a
 use Test::More;
a62a59a
 
a62a59a
@@ -19,6 +19,7 @@ unless(mkdir("$tmp/testdir") && chdir("$tmp/testdir") && rmdir("$tmp/testdir")){
a62a59a
 plan tests => 8;
a62a59a
 require Cwd;
a62a59a
 
a62a59a
+my @acceptable_errnos = (&Errno::ENOENT, (defined &Errno::ESTALE ? &Errno::ESTALE : ()));
a62a59a
 foreach my $type (qw(regular perl)) {
a62a59a
     SKIP: {
a62a59a
 	skip "_perl_abs_path() not expected to work", 4
a62a59a
@@ -36,12 +37,14 @@ foreach my $type (qw(regular perl)) {
a62a59a
 	$res = Cwd::getcwd();
a62a59a
 	$eno = 0+$!;
a62a59a
 	is $res, undef, "$type getcwd result on non-existent directory";
a62a59a
-	is $eno, ENOENT, "$type getcwd errno on non-existent directory";
a62a59a
+	ok((grep { $eno == $_ } @acceptable_errnos), "$type getcwd errno on non-existent directory")
a62a59a
+	    or diag "Got errno code $eno, expected " . join(", ", @acceptable_errnos);
a62a59a
 	$! = 0;
a62a59a
 	$res = Cwd::abs_path(".");
a62a59a
 	$eno = 0+$!;
a62a59a
 	is $res, undef, "$type abs_path result on non-existent directory";
a62a59a
-	is $eno, ENOENT, "$type abs_path errno on non-existent directory";
a62a59a
+	ok((grep { $eno == $_ } @acceptable_errnos), "$type abs_path errno on non-existent directory")
a62a59a
+	    or diag "Got errno code $eno, expected " . join(", ", @acceptable_errnos);
a62a59a
     }
a62a59a
 }
a62a59a
 
a62a59a
-- 
a62a59a
2.17.2
a62a59a