create: implement "file changed while backup" detection on Windows, fixes #9382#9384
Open
mr-raj12 wants to merge 1 commit intoborgbackup:masterfrom
Open
create: implement "file changed while backup" detection on Windows, fixes #9382#9384mr-raj12 wants to merge 1 commit intoborgbackup:masterfrom
mr-raj12 wants to merge 1 commit intoborgbackup:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9384 +/- ##
==========================================
- Coverage 76.44% 76.43% -0.01%
==========================================
Files 85 85
Lines 14799 14802 +3
Branches 2212 2212
==========================================
+ Hits 11313 11314 +1
- Misses 2808 2809 +1
- Partials 678 679 +1 ☔ View full report in Codecov by Sentry. |
d5d96b3 to
fb2a476
Compare
Member
|
is_win32 is true for native windows (msys2/mingw). what is the situation for cygwin (is_cygwin)? |
Contributor
Author
|
Cygwin has is_win32 = False, so none of these changes affect it and it was already running the fstat2 check with ctime before, and still does. Cygwin maps st_ctime to NTFS ChangeTime (POSIX semantics), not CreationTime, so ctime works fine there. |
fb2a476 to
4f2480c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fstat2check) was entirely skipped on Windows viaif not is_win32: # TODO for win32since b3751b1 (March 2019, should print a warning if file changed during backup #1750)st_ctimeis file creation time (not inode change time), so the default ctime-based detection was meaningless - but themtimecomparison path (added in b27df15, July 2025) works correctly on Windows sincest_mtimeupdateson writes
is_win32guard so the fstat2 + comparison logic runs on all platforms, and default--files-changedtomtimeon Windows instead ofctime--files-changed=ctimeon Windows, borg now warns and falls back tomtimeinstead of silently disabling detectionFixes #9382
Changes
src/borg/archive.pyif not is_win32guard at fstat2 check; defaultfiles_changedto"mtime"on win32src/borg/archiver/create_cmd.py--files-changed=ctimeon Windows; update help text and docssrc/borg/testsuite/archiver/create_cmd_test.pytest_files_changed_mtime— runs on all platforms including WindowsRelated issues: #1750, #7193, #8730
Checklist
master