Subject: Re: bug#52193: mv broken on non-APFS filesystems on macOS on coreutils >= 9.0

From: Paul Eggert <[email-masked]>
Date: Tue, 7 Dec 2021 10:51:06 -0800

On 12/6/21 20:40, Sudhip Nashi wrote:
> The issue should be reproducible when moving directories and files within ~/mntpnt, but not between that filesystem and the parent APFS one, and vice versa.
> 

Thanks, but as I don't have access to a macOS machine I don't know what 
"the issue" is. What are the symptoms visible to the user? Can you do 
the equivalent of an strace to show us what system calls are being executed?

As near as I can make out, on macOS mv should be doing the equivalent of 
the following:

    sfd = open ("source", O_RDONLY | O_NOFOLLOW);
    if (fclonefileat (sfd, AT_FDCWD, "destination", 0) != 0)
      {
         dfd = open ("destination", O_WRONLY | O_CREAT | O_EXCL, mode);
         next_start = lseek (sfd, 0, SEEK_DATA);
         ...

and evidently something is going wrong at or after the "...". What is it?