Skip to content

uucore/fsxattr: continue applying xattrs after an unsupported one - #16052

Open
lunatic1hero wants to merge 2 commits into
uutils:mainfrom
lunatic1hero:fix-mv-xattr-acl-drop
Open

lunatic1hero wants to merge 2 commits into
uutils:mainfrom
lunatic1hero:fix-mv-xattr-acl-drop

Conversation

@lunatic1hero

Copy link
Copy Markdown

Fixes #15814

apply_xattrs_fd_ignore_unsupported() stopped at the first xattr the
destination refused with ENOTSUP and returned Ok(()). In a cross-device
directory move, this meant system.posix_acl_access was never applied
if a user.* attribute was tried first, so the ACL was silently dropped.

This changes the helper to iterate the attributes, skip only the
unsupported ones, and still return the first other error.

I used an AI assistant for guidance on the contribution workflow; I
applied and reviewed the change myself.

@codspeed

codspeed Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning, 1 note

⚠️ 122 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

ℹ️ 1 benchmark has no flamegraph

The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.

See affected benchmarks

✅ 401 untouched benchmarks
⏩ 70 skipped benchmarks1


Comparing lunatic1hero:fix-mv-xattr-acl-drop (59fd00c) with main (8e267ce)

Open in CodSpeed

Footnotes

  1. 70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

match apply_xattrs_fd(dest, xattrs) {
Err(e) if is_xattr_unsupported(&e) => Ok(()),
res => res,
use xattr::FileExt;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a test, a unit test here is enough:
an unknown namespace like foo.x gets EOPNOTSUPP from the kernel, so apply it with a few user.* and check those are set

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

match apply_xattrs_fd(dest, xattrs) {
Err(e) if is_xattr_unsupported(&e) => Ok(()),
res => res,
use xattr::FileExt;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the doc comment above still says it maps ENOTSUP to Ok(()), please update it to say it skips the unsupported attributes

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread src/uucore/src/lib/features/fsxattr.rs Outdated
for (attr, value) in xattrs {
match dest.set_xattr(&attr, &value) {
Err(e) if is_xattr_unsupported(&e) => {}
res => res?,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

res => res? reads a bit odd, Err(e) => return Err(e), Ok(()) => {} is clearer, no?

@lunatic1hero

lunatic1hero commented Oct 31, 2026 via email

Copy link
Copy Markdown
Author

@sylvestre
sylvestre force-pushed the fix-mv-xattr-acl-drop branch from 75b6d6c to 96a97c4 Compare November 1, 2026 18:11
@sylvestre

Copy link
Copy Markdown
Contributor

thanks for this PR!
the fix looks right, but it still needs the unit test (unsupported foo.x next to a few user.*) and the doc comment update from the earlier review before it can land.

@lunatic1hero

Copy link
Copy Markdown
Author

thanks for this PR! the fix looks right, but it still needs the unit test (unsupported foo.x next to a few user.*) and the doc comment update from the earlier review before it can land.

sorry for the delay, had made the required changes before only, but was facing issues writing the test , as this is my first contribution, open for suggestions.

This branch has not been deployed

No deployments
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.

mv: cross-device directory move drops ACL if a user xattr is unsupported

2 participants