Subject: mv: extended attributes discarded when moving to a different volume on macOS

From: Daniel Smedegaard Buus <[email-masked]>
Date: Wed, 24 Mar 2021 12:13:06 +0100

Hello :)

I've been using Homebrewed coreutils on my Mac for a while, and recently
switched to MacPorts. With both of these package manager, the version of
`mv` that is built will discard extended attributes when moving an item
from one volume to another, though moving within the same volume the
attributes are retained (I assume because here moving is done by simply
editing an inode). The `mv` version that is bundled with OS X does not have
this shortcoming. My testing with Ubuntu also shows that this is not an
issue there.

I reported the bug to MacPorts, but was told that this is likely an
upstream problem, so I should take it here :) Here's to hoping that's true
:D

To reproduce (here with MacPorts, coreutils 8.32. Volumes are JHFS+):

daniel@titanic > xattr -w test fisso LICENSE
daniel@titanic > xattr -p test LICENSE
fisso
daniel@titanic > which mv
mv: aliased to /bin/mv
daniel@titanic > mv LICENSE /Volumes/Scratch
daniel@titanic > xattr -p test /Volumes/Scratch/LICENSE
fisso
daniel@titanic > /opt/local/libexec/gnubin//mv /Volumes/Scratch/LICENSE .
daniel@titanic > xattr -p test LICENSE
xattr: LICENSE: No such xattr: test

Cheers,
Daniel