coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] mv: add --swap (-s) option to atomically swap 2 paths


From: Petr Malat
Subject: Re: [PATCH] mv: add --swap (-s) option to atomically swap 2 paths
Date: Fri, 1 Mar 2024 12:05:26 +0100

Hi!
On Fri, Mar 01, 2024 at 09:18:31AM +0000, Padraig Brady wrote:
> On 29/02/2024 22:02, Petr Malat wrote:
> > renameat2() syscall allows atomically swapping 2 paths on one
> > file system. Expose this ability to the user using -s option.
> > 
> > * NEWS: Mention the new option
> 
> Thanks for the patch.
> 
> That was suggested previously:
> https://lists.gnu.org/archive/html/coreutils/2021-05/msg00030.html
> 
> I agree this is useful functionality,
> but the thinking is we should add this to a "replace" utility
> rather than to mv.

I have modified mv, because for me it would be a logical place where
to look for such a feature, and to make something usable, it must be
easy to find.

I may be affected by doing mostly low level programming and considering
mv to be a "shell interface" for the rename syscall with a copy fallback,
but I can imagine somebody working with mv could spot swap in the man
page and realize it's way better for his usecase than what he was trying
to do differently.

If you prefer, I may attempt to refactor the code to a separate binary.
BR,
  Petr



reply via email to

[Prev in Thread] Current Thread [Next in Thread]