On 18/11/15 16:05, Eric Blake wrote:
> Where could we use the new Linux renameat2() syscall within coreutils,
> if it is available? Oftentimes, having a working client of a syscall
> for a few filesystems is incentive for other filesystems to prioritize
> implementing support for the syscall. I'm really impressed by
> renameat2()'s ability to atomically swap two files, and moreso by its
> ability to replace a symlink with a directory or vice-versa (without an
> intermediate TOCTTOU race that we currently face via remove()/rename()
> pairs).
>
> http://www.dsm.fordham.edu/cgi-bin/man-cgi.pl?topic=renameat2=2
The file replacing functionality with --backup in copy.c
would probably benefit, as currently the dest file
may be missing for a while or partially written.
I've also noted to investigate it if we ever
get to implementing the "rewrite" utility.
cheers,
Pádraig.