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)
This commit is contained in:
Natanael Copa 2024-04-19 16:56:08 +02:00
parent 412e8b9a5d
commit 3eb5f92c52
2 changed files with 23 additions and 2 deletions

View file

@ -3,7 +3,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=coreutils
pkgver=9.5
pkgrel=0
pkgrel=1
pkgdesc="The basic file, shell and text manipulation utilities"
url="https://www.gnu.org/software/coreutils/"
arch="all"
@ -11,7 +11,9 @@ license="GPL-3.0-or-later"
makedepends="acl-dev attr-dev utmps-dev perl openssl-dev"
subpackages="$pkgname-doc $pkgname-env $pkgname-fmt $pkgname-sha512sum:_sha512sum"
install="$pkgname.post-deinstall"
source="https://ftp.gnu.org/gnu/coreutils/coreutils-$pkgver.tar.xz"
source="https://ftp.gnu.org/gnu/coreutils/coreutils-$pkgver.tar.xz
renameat2-fakeroot.patch
"
options="!check" # FAIL: tests/cp/reflink-auto
# secfixes:
@ -89,4 +91,5 @@ _sha512sum() {
sha512sums="
2ca0deac4dc10a80fd0c6fd131252e99d457fd03b7bd626a6bc74fe5a0529c0a3d48ce1f5da1d3b3a7a150a1ce44f0fbb6b68a6ac543dfd5baa3e71f5d65401c coreutils-9.5.tar.xz
a0317f6f42a0f821c6ec6745ff0f6be4ed9d2330ef1f886947a80a0f24dcddc6a28660c1d661da996577cc26b02c095a8aa058e553050acf90bce445ab07136a renameat2-fakeroot.patch
"

View file

@ -0,0 +1,18 @@
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