Skip to content

mv: keep copying xattrs after one fails on a cross-device move - #14629

Open
krosci wants to merge 2 commits into
uutils:mainfrom
krosci:mv-copy-xattr-continue-on-error
Open

krosci wants to merge 2 commits into
uutils:mainfrom
krosci:mv-copy-xattr-continue-on-error

Conversation

@krosci

@krosci krosci commented Sep 16, 2026

Copy link
Copy Markdown

When a cross-device move copies a file or directory that carries several xattrs, a single rejected attribute (e.g. one larger than the destination filesystem allows) used to abort the copy loop, silently dropping every remaining xattr, and the move reported success. GNU mv reports the failing attribute on stderr, copies on through the others, and still exits 0.

copy_xattrs*/apply_xattrs* in uucore now report each failing attribute, keep copying the rest, and return the first error. mv no longer aborts the directory path on a reported failure. cp uses a silent marker so the already-reported per-attribute diagnostics are not echoed a second time.

Fixes #14598.

Comment thread src/uu/cp/src/cp.rs Outdated
#[error("{}", translate!("cp-error-not-all-files-copied"))]
NotAllFilesCopied,

/// Extended-attribute copying failed, but every failure was already

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.

i think it can be a one line comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Comment thread src/uu/cp/src/cp.rs Outdated

// If copying xattrs failed, propagate that error now with context.
//
// `copy_xattrs*` already reported each failing attribute on stderr, so

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.

same, doesn't have to be that long

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@krosci
krosci requested a review from sylvestre September 16, 2026 23:14
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 move drops the rest of the xattrs after one failure, and reports success

2 participants