Skip to content

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

Open
lunatic1hero wants to merge 1 commit into
uutils:mainfrom
lunatic1hero:fix-mv-xattr-acl-drop
Open

lunatic1hero wants to merge 1 commit 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 degrade performance by 7.17%

2 warnings, 1 note

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

⚠️ Base and head ran on different runner types

Some benchmarks with significant performance changes were compared across different runner types, so the changes might not come from the code. Run base and head on the same runner type, or use CodSpeed Macro Runners for more stable results.

Learn more about Macro Runners

Open the report in CodSpeed to investigate

ℹ️ 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 improved benchmark
❌ 2 regressed benchmarks
✅ 398 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 mv_force_overwrite 127.9 ms 154.4 ms -17.14%
❌ CPU Simulation sort_long_line[10000] 999.6 µs 1,074.8 µs -7%
⚡ CPU Simulation du_wide_tree[(5000, 500)] 16 ms 15.4 ms +3.79%

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 (75b6d6c) with main (3544ef7)

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

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

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?

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