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
Contributor

Merging this PR will degrade performance by 3.32%

1 warning, 1 note

⚠️ 120 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

❌ 1 regressed benchmark
✅ 400 untouched benchmarks
⏩ 70 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ CPU Simulation du_wide_tree[(5000, 500)] 15.1 ms 15.6 ms -3.32%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing lunatic1hero:fix-mv-xattr-acl-drop (db02a33) with main (e03b9f6)2

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. ↩

  2. No successful run was found on main (663e2c9) during the generation of this report, so e03b9f6 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

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.

@sylvestre
sylvestre force-pushed the fix-mv-xattr-acl-drop branch from 59fd00c to db02a33 Compare November 4, 2026 09:21
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/df/over-mount-device. tests/df/over-mount-device is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/ptx/ptx. tests/ptx/ptx is passing on 'main'. Maybe you have to rebase?
Note: The gnu test tests/install/stdin is now being skipped but was previously passing.
Note: The gnu test tests/wc/wc-sjis is now being skipped but was previously passing.

@lunatic1hero

Copy link
Copy Markdown
Author

i have done the suggested changes in the second commit, the failing test doesn't seem to touch fsxattr . Could you take a look at them when you have time?

@lunatic1hero

Copy link
Copy Markdown
Author

i have done the suggested changes in the second commit, the failing test doesn't seem to touch fsxattr . Could you take a look at them when you have time?

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