Fix a race in File::stat() tests
This commit is contained in:
parent
eadda09063
commit
126f691220
|
@ -0,0 +1,48 @@
|
||||||
|
From 7c3f362035dec9b7eaec388b1f7f1619c1bd96a3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tony Cook <tony@develop-help.com>
|
||||||
|
Date: Mon, 4 Nov 2019 09:52:22 +1100
|
||||||
|
Subject: [PATCH] prevent a race between name-based stat and an open modifying
|
||||||
|
atime
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Most linux systems rarely update atime, so it's very unlikely
|
||||||
|
for this issue to trigger there, but on a system with classic atime
|
||||||
|
behaviour this was a race between open modifying atime and time()
|
||||||
|
ticking over.
|
||||||
|
|
||||||
|
gh #17234
|
||||||
|
|
||||||
|
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||||
|
---
|
||||||
|
lib/File/stat.t | 6 ++++--
|
||||||
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/File/stat.t b/lib/File/stat.t
|
||||||
|
index c403fc4498..fc9bb12cef 100644
|
||||||
|
--- a/lib/File/stat.t
|
||||||
|
+++ b/lib/File/stat.t
|
||||||
|
@@ -133,6 +133,9 @@ SKIP: {
|
||||||
|
test_X_ops($^X, "for $^X", qr/A/);
|
||||||
|
}
|
||||||
|
|
||||||
|
+# open early so atime is consistent with the name based call
|
||||||
|
+local *STAT;
|
||||||
|
+my $canopen = open(STAT, '<', $file);
|
||||||
|
|
||||||
|
my $stat = File::stat::stat($file);
|
||||||
|
isa_ok($stat, 'File::stat', 'should build a stat object');
|
||||||
|
@@ -143,8 +146,7 @@ for (split //, "tTB") {
|
||||||
|
}
|
||||||
|
|
||||||
|
SKIP: {
|
||||||
|
- local *STAT;
|
||||||
|
- skip("Could not open file: $!", 2) unless open(STAT, '<', $file);
|
||||||
|
+ skip("Could not open file: $!", 2) unless $canopen;
|
||||||
|
isa_ok(File::stat::stat('STAT'), 'File::stat',
|
||||||
|
'... should be able to find filehandle');
|
||||||
|
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
|
@ -281,6 +281,9 @@ Patch67: perl-5.31.5-Tie-StdHandle-BINMODE-handle-layer-argument.patch
|
||||||
Patch68: perl-5.31.5-toke.c-Fix-bug-tr-upgrading-to-UTF-8-in-middle.patch
|
Patch68: perl-5.31.5-toke.c-Fix-bug-tr-upgrading-to-UTF-8-in-middle.patch
|
||||||
Patch69: perl-5.31.5-toke.c-comment-changes.patch
|
Patch69: perl-5.31.5-toke.c-comment-changes.patch
|
||||||
|
|
||||||
|
# Fix a race in File::stat() tests, GH#17234, in upstream after 5.31.5
|
||||||
|
Patch70: perl-5.31.5-prevent-a-race-between-name-based-stat-and-an-open-m.patch
|
||||||
|
|
||||||
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
|
# 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
|
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
|
||||||
|
|
||||||
|
@ -2871,6 +2874,7 @@ rm -rf .git # Perl tests examine a git repository
|
||||||
%patch67 -p1
|
%patch67 -p1
|
||||||
%patch68 -p1
|
%patch68 -p1
|
||||||
%patch69 -p1
|
%patch69 -p1
|
||||||
|
%patch70 -p1
|
||||||
%patch200 -p1
|
%patch200 -p1
|
||||||
%patch201 -p1
|
%patch201 -p1
|
||||||
|
|
||||||
|
@ -2935,6 +2939,7 @@ perl -x patchlevel.h \
|
||||||
'Fedora Patch67: Fix handling a layer argument in Tie::StdHandle::BINMODE() (RT#132475)' \
|
'Fedora Patch67: Fix handling a layer argument in Tie::StdHandle::BINMODE() (RT#132475)' \
|
||||||
'Fedora Patch68: Fix an unintended upgrade to UTF-8 in the middle of a transliteration' \
|
'Fedora Patch68: Fix an unintended upgrade to UTF-8 in the middle of a transliteration' \
|
||||||
'Fedora Patch69: Fix an unintended upgrade to UTF-8 in the middle of a transliteration' \
|
'Fedora Patch69: Fix an unintended upgrade to UTF-8 in the middle of a transliteration' \
|
||||||
|
'Fedora Patch70: Fix a race in File::stat() tests (GH#17234)' \
|
||||||
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
|
'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' \
|
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
|
||||||
%{nil}
|
%{nil}
|
||||||
|
@ -5186,6 +5191,7 @@ popd
|
||||||
- Fix taint mode documentation regarding @INC
|
- Fix taint mode documentation regarding @INC
|
||||||
- Fix handling a layer argument in Tie::StdHandle::BINMODE() (RT#132475)
|
- Fix handling a layer argument in Tie::StdHandle::BINMODE() (RT#132475)
|
||||||
- Fix an unintended upgrade to UTF-8 in the middle of a transliteration
|
- Fix an unintended upgrade to UTF-8 in the middle of a transliteration
|
||||||
|
- Fix a race in File::stat() tests (GH#17234)
|
||||||
|
|
||||||
* Mon Nov 11 2019 Jitka Plesnikova <jplesnik@redhat.com> - 4:5.30.1-447
|
* Mon Nov 11 2019 Jitka Plesnikova <jplesnik@redhat.com> - 4:5.30.1-447
|
||||||
- 5.30.1 bump (see <https://metacpan.org/pod/release/SHAY/perl-5.30.1/pod/perldelta.pod>
|
- 5.30.1 bump (see <https://metacpan.org/pod/release/SHAY/perl-5.30.1/pod/perldelta.pod>
|
||||||
|
|
Loading…
Reference in New Issue