Repository navigation
fix(save): preserve destination extended attributes on macOS - #3042
Open
PerchAnton wants to merge 1 commit into
Open
PerchAnton wants to merge 1 commit into
PerchAnton wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
What this changes
Addresses #2658: Finder tags and accessible extended attributes on macOS only.
Rotating a synthetic PDF and saving it successfully removed its Finder tags, binary custom attribute and empty custom attribute. The shared atomic writer now copies the existing regular destination's accessible xattrs to the open staging file after writing the PDF and before flush/rename. Both desktop Save and CLI/automation use this writer.
A metadata read/copy error refuses publication, removes the staging file and suggests Save As. The original file and unsaved edit remain available. Save As retains an existing destination's attributes; a new destination does not inherit the input PDF's tags.
How you verified it
On macOS, based directly on main
924c4da4, with two Cargo jobs and bounded command timeouts:cargo fmt --checkcargo test -p pdfcraft-platform -p pdfcraft-automation -j 2: 251 passed, 0 failed, 0 ignored (17 platform tests; 234 automation unit/integration tests)cargo clippy -p pdfcraft-platform -p pdfcraft-automation -j 2 --all-targets -- -D warningscargo check -p pdfcraft-platform -p pdfcraft-automation --target wasm32-unknown-unknown -j 2(four existing renderer warnings)layers,assetsandparitypasspage_render. Reopened renders inspected.Red before green: both the platform attribute-preservation regression and the automation save regression were run before the fix and failed with
Attribute not found. The unfixed CLI also reproduced successful incremental saving with all three test attributes lost.The six new macOS tests cover exact metadata before flush and after repeated saves using both staging name forms; binary/empty values; flush refusal; oversized resource-fork refusal before publication; symlink referent isolation; incremental/full saves and Save As; and an unsaved edit surviving a metadata failure and saving to a new name.
Full workspace builds, desktop GUI/Finder interaction, Windows/Linux runtime and external PDF viewers were not tested. Hosted CI still needs to run.
Never-crash
Provenance
rustixdependency; automation adds it only as a macOS test dependencySecurity
--rootchecks and opt-in MCP/control behaviour retained; no network addedNOFOLLOWandNONBLOCK; metadata is copied through file descriptors to the newly created staging fileParity and reach
doc_savetool reaches the fix; two new automation regressionsAnything a reviewer should look at first
This preserves accessible xattrs on an existing regular macOS destination. The OS-managed
com.apple.provenanceis left to macOS, and kernel-hidden compression attributes are not requested. Filesystems reporting no xattr support continue to work. A regular target whose attributes cannot be read/copied, or exceed the bounds above, now refuses in-place save rather than dropping metadata; Save As to a fresh name remains available.Permissions, ACLs, hard-link identity, creation dates and read-only policy are separate parts of #2658. In particular, #2544 preserves permission bits and #2699 refuses read-only targets; this branch does not include either PR and will need to retain their behaviour when merged. No claim is made to close all of #2658.