--bypass-lock: also skip the cache lock - #10158
Open
ThomasWaldmann wants to merge 1 commit into
Open
Conversation
The security checks done for commands without cache access only read the cache config, so they do not need the exclusive cache lock. Previously, e.g. "borg list --bypass-lock" was blocked by a concurrently running "borg create" using the same $HOME, because the security checks always acquired the cache lock. Commands that really open the cache (e.g. "borg info", "borg config --cache") still acquire the cache lock, as they might write to the cache. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 1.4-maint #10158 +/- ##
=============================================
+ Coverage 82.11% 82.13% +0.02%
=============================================
Files 38 38
Lines 11435 11437 +2
Branches 1802 1803 +1
=============================================
+ Hits 9390 9394 +4
+ Misses 1461 1459 -2
Partials 584 584 ☔ View full report in Codecov by Harness. |
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 #7255.
--bypass-lockonly skipped the repository lock, but the security checks run for every command still acquired the exclusive client-side cache lock viaCacheConfig, although they only read the cache config. Thus, e.g.borg list --bypass-lockwas blocked while aborg createusing the same $HOME was running.Now the bypass flag is passed down to
assert_secure/CacheConfig, which then reads the cache config without locking. This is safe because the cache config is only ever written viaSaveFile(atomic rename), so an unlocked reader always sees a complete file. When no lock is held, the relocated-repository handling only updates the security dir and does not write to the cache config.Commands that really open the cache (e.g.
borg info,borg config --cache) still acquire the cache lock, as they might write to the cache.Not an issue on master: borg2 removed
--bypass-lockand its cache has no lock.🤖 Generated with Claude Code