Repository navigation
Write XMP sidecars atomically and keep virtual copies off the master XMP - #1967
Open
apweisskopf wants to merge 2 commits into
Open
apweisskopf wants to merge 2 commits into
apweisskopf wants to merge 2 commits into
Conversation
fs::write truncates in place. A crash or full disk mid-write left a broken sidecar, and the error was dropped. Write to a temp file in the same folder, then rename, as .rrcache already does with the tempfile crate. The rename keeps what fs::write kept: - mode, symlink and name case of an existing file - the permission checks, through a write probe Unchanged content is not written, so the mtime only moves on real changes. Known limits: - a writable XMP in a read-only folder is no longer written. An in-place fallback would bring back the broken write - hard links break, xattrs are lost - a crash before the rename leaves a .rapidraw-*.xmp.tmp file - a dangling symlink is skipped Part of CyberTimon#1945.
A virtual copy shares the master's IMG.xmp. Every rating, label or tag change on a copy overwrote the master's values. - only the primary sidecar writes the XMP, the same rule as write_sidecar - copies also skip the XMP read on load. Otherwise a value removed on the copy comes back from the master's XMP Known limit: a copy of a master without .rrdata never sees the master's XMP values. Part of CyberTimon#1945.
This was referenced Oct 19, 2026
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.
Description
Two fixes that stop RapidRAW from damaging XMP sidecars. Part of #1945.
.xmp. The XMP is now written to a temp file and renamed, as.rrcachealready does with thetempfilecrate. No new dependency.IMG.xmp. Rating or tagging the copy overwrote the master's values. Copies now leave the XMP alone.The content of the written XMP does not change.
Type of Change
Changes Made
write_atomic: temp file in the same folder, fsync, renameTesting
Checked by hand on this branch:
Test Configuration:
Checklist
Additional Notes
One behaviour change: a writable XMP in a read-only folder is no longer written, because the temp file cannot be created there. It is logged. An in-place fallback would bring back the broken write.
Other known limits are in the commit message: hard links break, xattrs are lost, and a crash before the rename leaves a
.rapidraw-*.xmp.tmpfile.AI Disclaimer:
Please state the involvement of AI in this PR: