Repository navigation
mv: warn when the destination doesn't support xattrs - #15101
Open
Cassian433 wants to merge 1 commit into
Open
Cassian433 wants to merge 1 commit into
Cassian433 wants to merge 1 commit into
Conversation
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
force-pushed
the
mv-warn-enotsup-xattr
branch
from
October 5, 2026 19:34
f332d6b to
3d437ad
Compare
Merging this PR will improve performance by 4.22%
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
and exits 0. We print nothing, because
rename_file_fallbackin src/uu/mv/src/mv.rs copies throughcopy_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_fdand hands the failures to a newshow_xattr_failures_for. Any ENOTSUP/EOPNOTSUPP turns into a singlesetting 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_unsupportedin uucore is now public, and the message is a newmv-error-setting-attributeskey in en-US and fr-FR, mirroring cp'scp-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 mountthe 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_fallbackand the per-file copy inside a moved directory) are being reworked in #14971, so I left them alone. The same goes forrename_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.