Repository navigation
uucore/fsxattr: continue applying xattrs after an unsupported one - #16052
lunatic1hero wants to merge 1 commit into
Conversation
…dual unsupported attributes
Merging this PR will degrade performance by 7.17%2 warnings, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
| match apply_xattrs_fd(dest, xattrs) { | ||
| Err(e) if is_xattr_unsupported(&e) => Ok(()), | ||
| res => res, | ||
| use xattr::FileExt; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?, |
There was a problem hiding this comment.
res => res? reads a bit odd, Err(e) => return Err(e), Ok(()) => {} is clearer, no?
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.