From 90e21f00e582079f2b6fba2a094e5d473cc4a85d Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 19 Sep 2026 03:30:58 +0200 Subject: [PATCH] tests: test_timestamps_win32: compare the extracted atime with the archived one The test compared the atime of the extracted file with the atime of the input file after "borg create". If NTFS last access time updates are enabled (fsutil behavior query disablelastaccess: DisableLastAccess = 0), reading the input file for the backup updates its atime, while borg archives (and extract restores) the atime the file had before borg opened it (see #6194). So the test failed on such machines although borg worked correctly. GitHub's windows runners have last access time updates disabled, thus it passed there. Co-Authored-By: Claude Fable 5.1 --- src/borg/testsuite/archiver/extract_cmd_test.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/borg/testsuite/archiver/extract_cmd_test.py b/src/borg/testsuite/archiver/extract_cmd_test.py index 2bfb9c4a7a..1cc51fb68d 100644 --- a/src/borg/testsuite/archiver/extract_cmd_test.py +++ b/src/borg/testsuite/archiver/extract_cmd_test.py @@ -389,14 +389,14 @@ def test_timestamps_win32(archivers, request): platform.set_times("input/file", atime_ns=atime_ns, mtime_ns=mtime_ns, birthtime_ns=birthtime_ns) cmd(archiver, "repo-create", RK_ENCRYPTION) cmd(archiver, "create", "--atime", "test", "input") - sti = os.stat("input/file") with changedir("output"): cmd(archiver, "extract", "test") sto = os.stat("output/input/file") assert sto.st_mtime_ns == mtime_ns - # reading the input file for the backup might have updated its atime, so compare with the input file. - assert sto.st_atime_ns == sti.st_atime_ns - if hasattr(sti, "st_birthtime_ns"): # Python >= 3.12 + # borg archives the atime the input file had before borg opened it (see #6194), so do not compare with + # the input file: NTFS updates its atime when borg reads it, if last access time updates are enabled. + assert sto.st_atime_ns == atime_ns + if hasattr(sto, "st_birthtime_ns"): # Python >= 3.12 assert sto.st_birthtime_ns == birthtime_ns