Repository navigation
security: same local repo dir via another path is not a relocation, fixes #8188 - #10516
Merged
ThomasWaldmann merged 1 commit intoOct 11, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10516 +/- ##
=======================================
Coverage 89.25% 89.25%
=======================================
Files 104 104
Lines 19893 19941 +48
Branches 3118 3127 +9
=======================================
+ Hits 17756 17799 +43
- Misses 1478 1482 +4
- Partials 659 660 +1 ☔ View full report in Codecov by Harness. |
…ixes borgbackup#8188 The "repository was previously located at" check compared path strings only, so reaching the same local repository directory via a symlink, a bind mount or a different letter case on a case-insensitive filesystem looked like a relocation. Answering yes rewrote the stored location, so alternating between the paths kept triggering the prompt (breaking e.g. unattended prune). If the strings differ, but both are local paths referring to the same existing directory (same st_dev/st_ino, st_ino != 0), do not warn. The stored location and all displayed paths stay as they were. Remote locations are not affected, and a real move/rename (old path gone) still triggers the warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ThomasWaldmann
force-pushed
the
same-repo-dir-8188
branch
from
October 11, 2026 16:46
75a6575 to
a879f5c
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.
Fixes #8188.
The "repository was previously located at" check in
SecurityManager.assert_location_matches()compared path strings only (after the NFC/NFD normalization from #2913). So reaching the same local repository directory via a different path looked like a relocation:bar -> foo)FOOvsfooon macOS APFS)Answering "yes" rewrote the stored location, so alternating between the paths kept re-triggering the prompt, which breaks unattended runs (e.g. prune).
Change
If the path strings differ, borg now also checks whether both are local paths referring to the same existing directory (
os.stat+os.path.samestat). If they do, there is no warning.file) repositories with an absolute previous path.ssh://and other URL locations are never affected.st_ino == 0are never treated as "same".With borg 2's AEAD session keys, a copied repo is not a nonce-reuse risk, so skipping the warning when both paths provably are the same directory loses nothing.
Tests
test_repository_access_via_symlinkaccesses the repo via its path, then a symlink, then its path again, withBORG_RELOCATED_REPO_ACCESS_IS_OK=no. It expects no abort and an unchanged stored location. The test fails without the fix.test_repository_movestill covers a real rename triggering the warning.foo,FOOand a symlinkbargive no prompt; aftermv foo movedthe prompt still appears.The FAQ entry "How do I rename a repository?" got one sentence about this.
🤖 Generated with Claude Code