Skip to content

Commit 68c1b38

Browse files
tonycozkhwilliamson
authored andcommitted
Time::HiRes: allow not checking atime between stat and lstat
On a system with some sort of filesystem monitor such as a virus scanner the atime of the file can be modified by that monitor causing the test to fail. Testers can set PERL_FILE_ATIME_CHANGES to a true value to avoid comparing atime between the stat() and lstat() calls. Fixes Perl#19321
1 parent 151514b commit 68c1b38

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

dist/Time-HiRes/Changes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Revision history for the Perl extension Time::HiRes.
1212
- darwin: make sure the compiler can find the system perl headers
1313
https://github.com/Perl/perl5/issues/20362
1414
- darwin: make sure PERL_DARWIN is defined on darwin.
15+
- don't compare stat and lstat atime if PERL_FILE_ATIME_CHANGES is set in
16+
the environment.
17+
https://github.com/Perl/perl5/issues/19321
1518

1619
1.9764 [2020-08-10]
1720
- Fix a bunch of repeated-word typos

dist/Time-HiRes/t/stat.t

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ for (1..5) {
3636
SKIP: {
3737
if($^O eq "haiku") {
3838
skip "testing stat access time on Haiku", 2;
39-
}
39+
}
40+
if ($ENV{PERL_FILE_ATIME_CHANGES}) {
41+
# something else might access the file, changing atime
42+
$lstat->[8] = $stat->[8];
43+
}
4044
is_deeply $lstat, $stat, "write: stat and lstat returned same values";
4145
Time::HiRes::sleep(rand(0.1) + 0.1);
4246
open(X, '<', $$);

0 commit comments

Comments
 (0)