GNU bug report logs - #69532
mv's new -x option should be made orthogonal to -t/-T/default

Previous Next

Package: coreutils;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Mon, 4 Mar 2024 00:46:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #88 received at 69532 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>,
 Pádraig Brady <P <at> draigBrady.com>
Cc: Petr Malat <oss <at> malat.biz>, util-linux <util-linux <at> vger.kernel.org>,
 Dominique Martinet <asmadeus <at> codewreck.org>, 69532 <at> debbugs.gnu.org,
 Karel Zak <kzak <at> redhat.com>, Rob Landley <rob <at> landley.net>
Subject: Re: bug#69532: mv's new -x option should be made orthogonal to
 -t/-T/default
Date: Fri, 22 Mar 2024 18:44:39 -0700
[Message part 1 (text/plain, inline)]
On 3/21/24 14:45, Bernhard Voelker wrote:
> 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.

Yes, thanks, --exchange should act more like non --exchange there.


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

Good suggestion.


> It seems that -i is skipped:
> 
>    $ src/mv -iv --exchange a b
>    renamed 'a' -> 'b'

Yes, I suppose -i should be treated similarly too.

I installed the attached patches to do the above. (Basically, the 
problem was that my earlier patches were too ambitious; these patches 
scale things back to avoid some optimizations so that mv --exchange is 
more like ordinary mv.)

The first patch simplifies the code (and fixes a diagnostic to be more 
useful) without otherwise changing behavior; it's more of a refactoring. 
The second patch does the real work.

Thanks again.
[0001-cp-ln-mv-improve-dir-vs-nondir-diagnostics.patch (text/x-patch, attachment)]
[0002-mv-treat-exchange-more-like-non-exchange.patch (text/x-patch, attachment)]

This bug report was last modified 1 year and 153 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.