Subject: Re: bug#78509: Coreutils' mv and cp 9.5 do not work properly on old PPC Mac OS X 10.4.11, Tiger

From: Paul Eggert <[email-masked]>
Date: Tue, 20 May 2025 10:10:12 -0700

On 2025-05-20 09:12, Peter Dyballa via GNU coreutils Bug Reports wrote:
>     126 + mv k out
>     127 mv: cannot stat 'out/k': Not a directory

First, please build and run coreutils 9.7 and try that instead. If it 
works, we're done. (For what it's worth, I just now built and ran 
coreutils 9.7 on macOS 12.6 (ARM) and it worked fine.)

If the bug still occurs on your old platform with coreutils 9.7, please 
reproduce the problem yourself, with something like this:

    touch k out
    mv k out

Once you've narrowed it down to something you can reproduce reliably, 
please run 'mv' under a debugger to see why mv is incorrectly saying 
"Not a directory".

On GNU/Linux, when I run 'strace mv k out', the trace contains the 
following. Although macOS doesn't have strace (and its dtrace is so hard 
to use and so flaky I don't recommend it), perhaps you can use this as a 
guide for debugging mv under macOS. Notice that under GNU/Linux the 
openat fails with "Not a directory" but that's OK: mv eventually figures 
things out and does the renameat. Why isn't it doing something similar 
on your macOS platform?

renameat2(AT_FDCWD, "k", AT_FDCWD, "out", RENAME_NOREPLACE) = -1 EEXIST 
(File exists)
openat(AT_FDCWD, "out", O_RDONLY|O_PATH|O_DIRECTORY) = -1 ENOTDIR (Not a 
directory)
newfstatat(AT_FDCWD, "k", {st_mode=S_IFREG|0664, st_size=0, ...}, 
AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "out", {st_mode=S_IFREG|0664, st_size=0, ...}, 
AT_SYMLINK_NOFOLLOW) = 0
geteuid()                               = 1000
faccessat2(AT_FDCWD, "out", W_OK, AT_EACCESS) = 0
renameat(AT_FDCWD, "k", AT_FDCWD, "out") = 0