Repository navigation
fix(linux): copy xattrs before applying read-only modes - #55
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
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.
Summary
copy_metadata_linuxapplied the source mode before copying extended attributes. Linuxsetxattron auser.*attribute needs write access, so a read-only file (0444) or directory (0555) that carries one maderift createfail withPermission denied (os error 13)on reflink filesystems. The btrfs strategy uses the same helper for filtered imports.This change copies extended attributes before setting the mode, matching the order the APFS strategy already uses since #21.
Changes
crates/core/src/strategy/reflink.rs: callcopy_xattrs_linuxbeforefs::set_permissionsincopy_metadata_linux.native_copy_preserves_xattrs_on_read_only_entries, which copies a0444file and a0555directory that both carryuser.*attributes and checks the modes and attributes on the copy.Verification
On XFS with reflink, as a non-root user:
RIFT_REQUIRE_REFLINK_TESTS=1 cargo test -p rift --locked --lib strategy::reflink: the new test fails without the fix (Io(Os { code: 13, kind: PermissionDenied })) and passes with it (6 passed).cargo test --workspace --locked: all tests pass.cargo fmt --all -- --check: clean.cargo clippyreports no new warnings.444and theuser.originattribute.Fixes #54