fix(versioner): ensure version store dirs remain owner-writable (fixes #10532)#10575
Open
steadytao wants to merge 1 commit intosyncthing:mainfrom
Open
fix(versioner): ensure version store dirs remain owner-writable (fixes #10532)#10575steadytao wants to merge 1 commit intosyncthing:mainfrom
steadytao wants to merge 1 commit intosyncthing:mainfrom
Conversation
Member
|
The permissions should then be modified for the required duration and restored, like we do while syncing regular changes. |
b31d207 to
1ed20f9
Compare
…ing#10532) Signed-off-by: steadytao <[email protected]>
1ed20f9 to
18be545
Compare
Contributor
Author
|
Thank you for the review. I updated the versioner archive path to only temporarily add owner access to version-store directories when we need to create children, then restore the original modes afterwards (including special bits). I also added/adjusted tests covering:
Appreciate the guidance, it helped me land on a much cleaner approach |
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.
Purpose
Fixes a regression where version-store directories (e.g.
.stversions/a/b) can become read-only (0555), preventing Syncthing from creating nested version paths during later archive operations (#10532).If a parent directory inside the version store loses owner-write permission, subsequent attempts to archive files into deeper paths fail with a permission error. This prevents further versions from being archived for affected folders.
This patch ensures version-store directories always remain owner-writable so nested paths can be created safely.
Changes Made
The fix is intentionally minimal:
Background
Recent permission synchronisation changes caused version-store directories to inherit restrictive permissions from the source folder. In cases where a source directory was read-only (e.g. 0555), the corresponding version-store directory could also become read-only.
Because the version store must create additional nested directories over time, this could leave it permanently unable to archive further versions.
This change ensures version-store directories remain owner-writable while preserving all other permission bits.
Testing
Added a regression test that:
0555.Additionally verified: