aports/main/coreutils/renameat2-fakeroot.patch
Natanael Copa 3eb5f92c52 main/coreutils: fix mv under fakeroot
coreutils 9.5's mv started to use gnulibs renematu which will use
renameat2 if found or fallback to direct syscall. musl does not
implement renameat2 so gnulib will cal syscall directly and escape
fakeroots interception.

To work around this, disable using the direct syscall and use the
fallback from gnulib for now.

ref: 5a1d00e450 (diff-77785922df73494c9b82cf14280acd36a5ec8c06c0ab750651d12ee21d9f7d52R2721)
ref: 6761c11214/lib/renameatu.c (L110)
2024-04-19 17:00:36 +02:00

18 lines
646 B
Diff

calling the syscall directly for renameat2 breaks fakeroot.
Force fallback til musl has implemented renameat2.
ref: https://gitlab.alpinelinux.org/alpine/aports/-/issues/16016
diff --git a/lib/renameatu.c b/lib/renameatu.c
index 6893232..a6b278d 100644
--- a/lib/renameatu.c
+++ b/lib/renameatu.c
@@ -109,7 +109,7 @@ renameatu (int fd1, char const *src, int fd2, char const *dst,
#ifdef HAVE_RENAMEAT2
ret_val = renameat2 (fd1, src, fd2, dst, flags);
err = errno;
-#elif defined SYS_renameat2
+#elif defined SYS_renameat2 && defined BREAK_FAKEROOT
ret_val = syscall (SYS_renameat2, fd1, src, fd2, dst, flags);
err = errno;
#endif