Fix PathTools tests to cope with ESTALE error

This commit is contained in:
Petr Písař 2018-11-30 14:01:31 +01:00
parent a23ff061c5
commit e3cdc90d65
2 changed files with 65 additions and 0 deletions

View File

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

View File

@ -198,6 +198,10 @@ Patch30: perl-5.28.0-Pass-CFLAGS-to-dtrace.patch
Patch31: perl-5.28.1-regexec.c-Rename-variable.patch
Patch32: perl-5.28.1-PATCH-perl-133547-script-run-broken.patch
# Fix PathTools tests to cope with ESTALE error, RT#133534,
# in upstream after 5.29.3
Patch33: perl-5.29.3-Accept-also-ESTALE-fix-for-RT-133534.patch
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
@ -2781,6 +2785,7 @@ Perl extension for Version Objects
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch200 -p1
%patch201 -p1
@ -2814,6 +2819,7 @@ perl -x patchlevel.h \
'Fedora Patch28: Fix a spurious warning about uninitialized value in warn (RT#132683)' \
'Fedora Patch30: Pass the correct CFLAGS to dtrace' \
'Fedora Patch31: Fix script run matching to allow ASCII digits in scripts that use their own in addition (RT#133547)' \
'Fedora Patch33: Fix PathTools tests to cope with ESTALE error (RT#133534)' \
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
%{nil}
@ -5105,6 +5111,7 @@ popd
* Fri Nov 30 2018 Petr Pisar <ppisar@redhat.com> - 4:5.28.1-427
- Fix script run matching to allow ASCII digits in scripts that use their own in
addition (RT#133547)
- Fix PathTools tests to cope with ESTALE error (RT#133534)
* Fri Nov 30 2018 Jitka Plesnikova <jplesnik@redhat.com> - 4:5.28.1-426
- 5.28.1 bump