Skip to content

Preserve Windows readonly permissions - #7

Open
noise64 wants to merge 2 commits into
golem-rustic_core-v0.13.0from
fix-windows-permissions
Open

noise64 wants to merge 2 commits into
golem-rustic_core-v0.13.0from
fix-windows-permissions

Conversation

@noise64

@noise64 noise64 commented Dec 2, 2026 •

Copy link
Copy Markdown
  • GOL-2217: capture Windows read-only modes and restore permissions after timestamps. Leave symlink permissions unchanged and propagate metadata failures.
  • Set Windows timestamps through an attribute-only handle. Before writing changed contents, clear the read-only flag of an existing regular file. Restore the snapshot's saved permissions after the contents and timestamps.
  • Extend the read-only regression to restore A, A again, then a writable B with different contents and times into the same destination. Do not clear the destination or reset its permissions between restores. Regenerate the Windows snapshots for the read-only mapper.
  • Native Windows test_restore_preserves_readonly_files_and_nested_directory_times reproduced the second-A timestamp failure before the fix and passed the committed A→A→B sequence after it. Linux restore and hard-link controls also ran. This is fork integration coverage, not a Golem release build or application smoke test.
  • Used by golemcloud/golem#4762 and golemcloud/golem#4761.

@noise64
noise64 changed the base branch from main to golem-rustic_core-v0.13.0 December 2, 2026 14:02
@noise64
noise64 marked this pull request as ready for review December 3, 2026 12:57
@kmatasfp

kmatasfp commented Dec 4, 2026

Copy link
Copy Markdown

Could you cover restoring the same snapshot twice into the same Windows destination? The new test checks the first restore into an empty directory. On the second restore, the destination file is already read-only because the first restore made it so. Rustic reapplies timestamps even to unchanged files, and the Windows timestamp helper opens the file for writing. With fail_on_metadata_error(true), that can fail before the permission step.

I’d extend the regression to run the restore twice without clearing the destination or resetting permissions between runs, then check the contents, timestamp, and read-only attribute. Golem clears its destination before each restore, so this is a fork issue rather than a failure of the Golem caller. While touching this, please also update the option docs, which still say Windows restores only timestamps.

vigoo commented Dec 4, 2026

Copy link
Copy Markdown

There’s a second in-place restore case beyond the repeat-snapshot timestamp failure: restoring changed contents over a file the first restore marked read-only. If snapshot A contains a read-only file and snapshot B contains a writable version of a different length, Rustic restores contents before metadata. set_length opens the existing file with .write(true) while it is still read-only. Windows can deny that open before Rustic gets to apply B’s writable mode. Disabling fail_on_metadata_error does not help: this is a content error.

Please cover both paths before merge. On Windows, restore A twice with strict metadata handling, then restore B into the same destination, without manually resetting permissions. Check the bytes, modification time, and read-only attribute after each restore. The B step distinguishes a fix for content replacement from one that only fixes timestamp access.

I traced this on the PR head. Both fork restore integration tests passed on Linux; I did not run the scenario on native Windows.

noise64 commented Dec 4, 2026

Copy link
Copy Markdown
Author

Fixed in a7001da.

1 similar comment

noise64 commented Dec 4, 2026

Copy link
Copy Markdown
Author

Fixed in a7001da.

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.

3 participants