bug#13601: mv should not silently lose file extended attributes
From:
Collin Funk
Subject:
bug#13601: mv should not silently lose file extended attributes
Date:
Sat, 15 Aug 2026 21:27:37 -0700
User-agent:
Gnus/5.13 (Gnus v5.13)
Paul Eggert <eggert@cs.ucla.edu> writes:
> Since mv ordinarily acts like 'cp --preserve=all' when copying, presumably mv
> should warn in this situation if cp warns.
>
> Also, if no mv options other than -i and -f are used, a diagnostic is
> needed to conform to the spirit of POSIX, as the POSIX spec says for
> this situation "If the duplication of the file characteristics fails
> for any reason, mv shall write a diagnostic message to standard error,
> but this failure shall not cause mv to modify its exit status."[1]
> Contrary to the original bug report POSIX does not require (and
> seemingly does not allow) the mv to be aborted if file characteristics
> are lost in the copy, but at least the user should be warned about the
> situation.
Thanks for the link. POSIX seems pretty clear here.
The attached patch should fix things. I was tempted to add another
option to "struct cp_options", but it was more unwieldy then just
setting "require_preserve_xattr" and special casing "move_mode" to not
change the exit status.
It would be nice to add a test but it seems strace can't inject
ENOTSUP. I'll see if I can think of an alternative.
Collin