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

From: Dominique Martinet <[email-masked]>
Date: Tue, 5 Mar 2024 14:05:36 +0900

Paul Eggert wrote on Mon, Mar 04, 2024 at 08:10:35PM -0800:
> so there's little prior art there, and there's still plenty of time to fix
> its problems before exposing it to the world.

Yes, I just meant that everyone should agree, or there's little point in
implementing these for toybox/busybox, which is why I added Rob to Ccs
as I do not know if he's subscribed to the debbugs list.
(for busybox, Rob sent a mail to the busybox list about the feature,
someone should reply to that mail once this discussion has settled)

> > 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....

I have scripts that use an alternate implementation (since I've sent my
tentative patch two years ago);
I will likely be updating them to use mv -x once that is available on
the platform they're intended to run on.

> > (by the way, what's this "rename" command you speak of?
> 
> https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/

Right, that's installed as rename.ul on debian because they've
historically always had another rename command.
It's not a command that can be relied on easily.... And I guess
util-linux folks decided rename_exchange didn't belong there anyway
given your next point:

> 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).

eh, exch has been implemented last December and isn't part of any
release yet either (although it is in v2.40-rc1 so it will be part of
v2.40 shortly)

I guess it's definitely simpler than whatever will happen to mv and
would go as far as suggesting coreutils could also drop this
implementation as well now there's an alternative, but I'll leave that
up to you.

(
  And I really wish people would stop adding new commands all the time...
  This is bad both from a discoverability point of view (I look at the
  help/man pages of commands I know more often than I go through the list
  of new commands installed on my computer) and size (util-linux doesn't
  have a single binary mode and there's a lot of overhead - especially
  since binutils have been taking up 68KB per trivial binaries for a few
  releases now)
  But anyway these two points have nothing to do with coreutils, so I'll
  stop my rant here - thanks for noticing exch; I'll switch to lurking
  from now and decide on what to do with my scripts in another while.
)

-- 
Dominique Martinet | Asmadeus