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

From: Bernhard Voelker <[email-masked]>
Date: Thu, 21 Mar 2024 22:45:24 +0100

On 3/21/24 00:56, Paul Eggert wrote:
> On 3/20/24 15:53, Bernhard Voelker wrote:
> Yes, that's the expected behavior for this contrived case. Just as one
> would get odd behavior if one did the same thing without --exchange.

There's another which is not consistent with/without --exchange:

   $ src/mv -v a a
   src/mv: 'a' and 'a' are the same file

   $ src/mv -v --exchange a a
   renamed 'a' -> 'a'

RENAME_EXCHANGE is allowed (but useless?) for 1 file.

BTW: shouldn't the -v diagnostic better say "exchanged 'a' <-> 'a'"
because that's what happened?

>>     - not sure if exchange works well together with -f.
>
> What problems do you see there?

it's up to the tests to proof that.

>> why does exchange not work to exchange a regular with a
>> directory file?
>
> It works. I don't see a problem there.
>
>     $ touch a
>     $ mkdir d
>     $ ./mv -T --exchange a d
>     $ ls -ld a d
>     drwxr-xr-x. 2 eggert eggert 4096 Mar 20 16:52 a
>     -rw-r--r--. 1 eggert eggert    0 Mar 20 16:52 d

indeed, it works.  It seems my test was wrong, sorry.

>> Finally, the test cases are very sparse:
>
> Feel free to add some. :-)

Unfortunately, I cannot currently spend as much time as I'd love to.

It seems that -i is skipped:

   $ src/mv -iv --exchange a b
   renamed 'a' -> 'b'

As far as I know Padraig would like to do the next release very soon,
so I would recommend to not hurrying this one into it, and instead
ironing all out after the release.

Have a nice day,
Berny