Subject: bug#32796: please consider using renameat2 from glibc if available

From: Johannes Schauer <[email-masked]>
Date: Fri, 21 Sep 2018 08:44:09 +0200

Hi,

tools like `mv` currently perform a direct renameat2 syscall. This is
problematic for software like fakechroot which allows one to perform a fake
chroot call without being root by intercepting and overriding libc functions
using LD_PRELOAD. It is currently not possible to perform a `mv` with recent
versions of coreutils inside a fakechroot environment because coreutils uses
the renameat2 syscall directly instead of using a libc function.

This problem could be solved by coreutils using the glibc renameat2 function in
glibc version 2.28 and newer. If glibc is older, coreutils could fall back to
performing a plain syscall instead to keep backwards compatibility.

Thanks!

cheers, josch