On 3/4/24 18:43, Dominique Martinet wrote: > Adding Rob to the loop because this impacts compatibility with > toybox/maybe busybox implementations > (Quoting in full for convenience, there's a few more mails in > https://lists.nongnu.org/archive/html/bug-coreutils/2024-03/msg00002.html > but we seem to be missing Petr's reply) > > Pádraig Brady wrote on Mon, Mar 04, 2024 at 03:47:23PM +0000: >> On 04/03/2024 00:44, Paul Eggert wrote: >> > Although I like the idea of exposing file swaps to the user, the first >> > cut of 'mv -x' has significant problems. >> > >> > I expect 'mv -x A B' to act like 'mv A B' except the destination must >> > exist and is renamed back to A. However, this is not true for 'mv -x A >> > B' when B is a directory; it renames B to A rather than renaming B/A to >> > A as I expect.
I don't expect that. I expect it to swap the two. I don't care if one is a directory and the other is a symlink or file or device node or what. I asked it to swap A and B. It did that. If I wanted to ask it to swap with B/A I could have said so. >> > That is, 'mv -x' acts as if -T (--no-target-directory) is >> > also specified. Then document that? >> Also if we made this change, We'd have to document that `mv -x 1 2 ... d` >> was not atomic over the whole set. Making the atomic exchange not be atomic kind of defeats the purpose... Rob