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 #35 received at 69532 <at> debbugs.gnu.org (full text, mbox):

From: Rob Landley <rob <at> landley.net>
To: Dominique Martinet <asmadeus <at> codewreck.org>,
 Pádraig Brady <P <at> draigBrady.com>
Cc: 69532 <at> debbugs.gnu.org, Petr Malat <oss <at> malat.biz>,
 Paul Eggert <eggert <at> cs.ucla.edu>
Subject: Re: bug#69532: mv's new -x option should be made orthogonal to
 -t/-T/default
Date: Mon, 4 Mar 2024 20:24:01 -0600
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




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.