bug#13601: mv should not silently lose file extended attributes
Pádraig Brady <[email protected]>
| Newsgroups | gmane.comp.gnu.core-utils.bugs |
|---|---|
| Message-ID | <[email protected]> |
On 16/08/2026 05:27, Collin Funk wrote: > Paul Eggert <[email protected]> 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. The logic looks sound. We might get complaints for the extra warnings, but I suppose users can `cp -a && rm` for more granular warning support. > 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. EOPNOTSUPP works Another option is to perhaps augment tests/cp/cp-mv-enotsup-xattr.sh BTW it would be good to reference https://bugs.gnu.org/13601 in the commit message. thanks! Padraig