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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When I knew RENAME_EXCHANGE, I thought we should extend mv command as
you did: adding --swap.  However, after researching the past
challenges, I decided not to propose the feature to coreutils.

    https://www.gnu.org/software/coreutils/rejected_requests.html
    https://lists.gnu.org/archive/html/coreutils/2018-12/msg00004.html
    https://www.mail-archive.com/coreutils@xxxxxxx/msg10276.html

Masatake YAMATO

> On 05/03/2024 04:10, Paul Eggert wrote:
>> 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.
> 
> I think having the functionality in mv(1) is better than in rename(1),
> but since exch(1) is already released that's probably
> the best place for this functionality now.
> 
> A separate exch command may be overkill for just this,
> but perhaps related functionality might be added to that command in
> future.
> For e.g. some of the discussed functionality for a "replace" command
> might reside there.
> 
> So I think I'll remove the as yet unreleased mv --swap from coreutils,
> given that
> util-linux is as widely available as coreutils on GNU/Linux platforms.
> 
> cheers,
> Pádraig
> 
> 





[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux