Subject: Re: bug#65599: mv and cp give a pointless warning when moving/copying a directory

From: Bruno Haible <[email-masked]>
Date: Sat, 02 Sep 2023 01:12:28 +0200

Paul Eggert wrote:
> Good, thanks for confirming that the chmod family does not have a 
> similar bug.

Well, you asked me to try it on / but / is an ext4 FS, not a CIFS FS
on my system. Should I try it also on a directory inside the CIFS mount?

> I installed the attached workaround into coreutils master on Savannah. 
> Please give it a try.

It does remove the diagnostic as intended:

Preparations:
$ mkdir dir3 dir4
$ echo foo > dir3/file3
$ echo foo > dir4/file4

With coreutils-9.4:
$ mv dir3 /media/nas/bruno/
/gnu-inst-coreutils/9.4/bin/mv: failed to preserve ownership for '/media/nas/bruno/dir3': Permission denied

With coreutils from git now:
$ src/mv dir4 /media/nas/bruno/

I had worries regarding losing diagnostics that would be worth seeing.
But in fact, coreutils-9.4 did not actually produce such a diagnostic.
So, there is no regression for this case.

Preparations:
$ mkdir dir1 dir2
$ echo foo > dir1/file1
$ echo foo > dir2/file2
$ chmod a+rwx dir1 dir2
$ sudo chown root:root dir1 dir2

With coreutils-9.4:
$ mv dir1 /media/nas/bruno/dir1

With coreutils from git now:
$ src/mv dir2 /media/nas/bruno/dir2

Bruno