coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

cp: `--remove-destination` + `--attributes-only` should copy symlinks

Open jtracey opened this issue 3 years ago • 3 comments

This is causing the latest version of the tests/cp/attr-existing GNU test to fail.

jtracey avatar Jan 27 '22 18:01 jtracey

I can give this a shot

water-ghosts avatar Jan 30 '22 05:01 water-ghosts

I think --remove-destination is a red herring, and the issue here is how the flags -a and --attributes-only interact.

printf '1' > file1
ln -s file1 sym1
cp --attributes-only sym1 file2 && test -L file2     # GNU: 1, UUtils: 1
cp -a sym1 file3 && test -L file3                    # GNU: 0, UUtils: 0
cp -a --attributes-only sym1 file4 && test -L file4  # GNU: 0, UUtils: 1

GNU seems to give -a priority over --attributes-only when copying a symlink, while UUtils seems to give --attributes-only priority. I'll work on a fix for this issue, and we can see if that fixes the GNU tests.

water-ghosts avatar Jan 30 '22 19:01 water-ghosts

Is there a reason why this topic got lost 2 years ago?

cre4ture avatar Jan 17 '24 16:01 cre4ture