Repository navigation
mv: warn when the destination doesn't support xattrs - #15101
Conversation
f332d6b to
3d437ad
Compare
Merging this PR will not alter performance1 warning, 1 note
Comparing Footnotes
|
| target_os = "android", | ||
| target_os = "netbsd" | ||
| ))] | ||
| fn show_xattr_failures_for(to: &Path, failed: Vec<(OsString, io::Error)>) { |
There was a problem hiding this comment.
could this be merged into show_xattr_failures with an optional path, rather than adding a second helper with a near-identical name?
| /// distinct on the BSDs). | ||
| #[cfg(unix)] | ||
| fn is_xattr_unsupported(err: &std::io::Error) -> bool { | ||
| pub fn is_xattr_unsupported(err: &std::io::Error) -> bool { |
There was a problem hiding this comment.
copy_xattrs_fd_ignore_unsupported no longer has any callers after this change, could you please remove it?
| }; | ||
| // user::rw-, user:0:r--, group::r--, mask::r--, other::---. The named user | ||
| // keeps the kernel from folding it into the mode bits. | ||
| let acl: &[u8] = &[ |
There was a problem hiding this comment.
the raw ACL bytes are hard to check, could we use setfacl -m u:0:r instead and skip if it's missing?
|
sorry but it needs to be rebased, and a bunch of jobs are failing |
3d437ad to
a3f0a09
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
a3f0a09 to
73e3257
Compare
|
GNU testsuite comparison: |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
d46364c to
38c0ac2
Compare
Should make test cp/cp-mv-enotsup-xattr pass Co-authored-by: Cassian433 <[email protected]>
38c0ac2 to
8277e6e
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
Thanks for your PR |
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.