Subject: bug#69532: mv's new -x option should be made orthogonal to -t/-T/default

From: Paul Eggert <[email-masked]>
Date: Mon, 4 Mar 2024 20:10:35 -0800

On 3/4/24 16:43, Dominique Martinet wrote:
> Adding Rob to the loop because this impacts compatibility with
> toybox/maybe busybox implementations

Busybox does not use RENAME_EXCHANGE, so this isn't a Busybox issue.

Toybox mv added -x to its development version yesterday:

https://github.com/landley/toybox/commit/a2419ad52d489bf1a84a9f3aa73afb351642c765

so there's little prior art there, and there's still plenty of time to 
fix its problems before exposing it to the world.

> I also see --swap mostly used by scripts and this actually feels a bit
> dangerous to me -- I'd *always* use this with -T.

Yes, it's a problem.

By "see --swap mostly used by scripts" I assume you mean scripts that 
haven't been written yet, assuming that nobody had -x until yesterday....

> (by the way, what's this "rename" command you speak of?

https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/

Now that I've looked into it further, util-linux already has an "exch" 
command that does exactly what you want. This is the command that toybox 
should implement rather than try to simulate it with "mv -x" (which 
causes all sorts of problems).

That is, toybox should revert yesterday's change to "mv", and should 
implement "exch" instead.