Skip to content

mv: warn when the destination doesn't support xattrs - #15101

Open
Cassian433 wants to merge 1 commit into
uutils:mainfrom
Cassian433:mv-warn-enotsup-xattr
Open

Cassian433 wants to merge 1 commit into
uutils:mainfrom
Cassian433:mv-warn-enotsup-xattr

Conversation

@Cassian433

Copy link
Copy Markdown
Contributor

Closes #15079

Since the bump to GNU 9.12, the mv half of tests/cp/cp-mv-enotsup-xattr fails. GNU 9.12 mv, moving a file with xattrs onto a file system without xattr support, prints

mv: setting attributes for 'noxattr/a': Operation not supported

and exits 0. We print nothing, because rename_file_fallback in src/uu/mv/src/mv.rs copies through copy_xattrs_fd_ignore_unsupported, which drops ENOTSUP. That matched the old manual ("all but 'Operation not supported' warnings"), which #10083 followed. The 9.12 manual now says "Upon failure all warnings are emitted, but do not modify the exit status."

The file path now calls copy_xattrs_fd and hands the failures to a new show_xattr_failures_for. Any ENOTSUP/EOPNOTSUPP turns into a single setting attributes for 'DEST': ... line for the file. Other errors keep the per-attribute lines from #15049. A source with no xattrs still moves silently, and so does a file whose only xattr is a POSIX ACL, because GNU is quiet there as well. is_xattr_unsupported in uucore is now public, and the message is a new mv-error-setting-attributes key in en-US and fr-FR, mirroring cp's cp-error-setting-attributes.

I wasn't sure whether GNU prints one line per file or one per attribute, so I built 9.12 from the release tarball and ran its mv against a ramfs and a vfat loop mount. Three user.* attributes give one line. trusted.* and security.* (as root) give the same single line. An ACL alone gives nothing; an ACL plus a user.* attribute gives the line. Over 15 cases (one, three and no attributes, ACL only, ACL plus user, same fs, overwriting, dir/ as the target, a relative target) this branch matches GNU 9.12 on stderr and exit status. Main is missing 9 of those lines.

test_mv_xattr_enotsup_silent asserted the old silence, and it only hit the ENOTSUP case on kernels older than 6.6, where /dev/shm refuses user xattrs. I replaced it with test_mv_xattr_enotsup_warns_once. It mounts a ramfs with sudo -E --non-interactive mount the way test_cp_reflink_always_override does, and skips when that fails. It moves files with one and with three attributes and expects exactly one warning line for each. Then it checks that a file with no xattrs and one with only an ACL move silently, and that a same-fs move stays quiet. It unmounts before asserting. Because it needs sudo, CI runs it on the Linux runners and skips it elsewhere. Locally (Linux 7.0, ext4 to ramfs) it passes on this branch and fails on main with an empty stderr. The rest of test_mv and test_cp pass, and clippy is clean.

cp-mv-enotsup-xattr should flip to PASS.

The directory paths (rename_dir_fallback and the per-file copy inside a moved directory) are being reworked in #14971, so I left them alone. The same goes for rename_symlink_fallback, which on main is also reached from the directory copy. GNU warns on those paths too, so they can follow once #14971 lands. The branch merges cleanly with #14971 and #13334.

GNU 9.12 no longer stays quiet when a cross-device move lands on a file
system without xattr support: it prints one "setting attributes for" line
per file and still exits 0. Do the same for regular files. A file whose
only xattr is a POSIX ACL still moves silently, as with GNU.

Closes uutils#15079
@Cassian433
Cassian433 force-pushed the mv-warn-enotsup-xattr branch from f332d6b to 3d437ad Compare October 5, 2026 19:34
@codspeed

codspeed Bot commented Oct 5, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 4.22%

⚡ 1 improved benchmark
✅ 39 untouched benchmarks
⏩ 412 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ du_wide_tree[(5000, 500)] 15.9 ms 15.3 ms +4.22%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing Cassian433:mv-warn-enotsup-xattr (f332d6b) with main (de6f937)2

Open in CodSpeed

Footnotes

  1. 412 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 (9caa727) during the generation of this report, so de6f937 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

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: no warning when the destination file system doesn't support xattrs (GNU cp-mv-enotsup-xattr, 9.12)

1 participant