Skip to content

tests: test_timestamps_win32: compare the extracted atime with the archived one - #10392

Merged
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:fix-test-timestamps-win32-atime
Sep 19, 2026
Merged

ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:fix-test-timestamps-win32-atime

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Problem

test_timestamps_win32 fails (all 3 variants) on a Windows 11 machine that has NTFS last access time updates enabled (fsutil behavior query disablelastaccessDisableLastAccess = 0):

assert 1500000000000000100 == 1789776435961309900

The left value is the atime of the extracted file (correct), the right one is the atime of the input file, stat'ed after borg create.

The test assumed that borg archives the atime the input file has after the backup read it. But since #6194, borg archives the atime the file had before borg opened it. With last access time updates enabled, reading the input file bumps its atime to "now", so the comparison fails although borg works correctly. GitHub's windows runners have last access time updates disabled, so the test passes there.

Measurements on that machine

step atime
platform.set_times() by path / by fd (same sequence as extract_item) the value that was set
plain open + read + close bumped to now
input/file after borg create --atime bumped to now
output/input/file after borg extract (and 5 s later) 1500000000000000100
atime in the archive (borg list) 2017-07-14 04:40:00 (the original one)

So set_times in platform/windows.pyx and borg extract are fine, only the test was wrong.

Fix

Compare the extracted atime with the atime_ns the test has set (same as the mtime and birthtime assertions do, and same as test_atime does). This holds no matter whether last access time updates are enabled or not.

Verified on the Windows 11 box (MSYS2 UCRT64, Python 3.14): before 3 failed, after 3 passed (archiver, remote_archiver, binary_archiver).

🤖 Generated with Claude Code

…chived 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 borgbackup#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 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.13%. Comparing base (7a16a03) to head (90e21f0).
⚠️ Report is 5 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10392      +/-   ##
==========================================
- Coverage   88.19%   88.13%   -0.07%     
==========================================
  Files         103      103              
  Lines       18822    18822              
  Branches     2919     2919              
==========================================
- Hits        16600    16588      -12     
- Misses       1548     1558      +10     
- Partials      674      676       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@ThomasWaldmann
ThomasWaldmann merged commit 8022eba into borgbackup:master Sep 19, 2026
41 of 43 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the fix-test-timestamps-win32-atime branch September 19, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant