commit: 44dbc1d96a9d125ce3c954b2477604e70a2bf727 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Thu Aug 28 15:23:08 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Thu Aug 28 15:23:35 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=44dbc1d9
sys-fs/zfs: fix build w/ musl Closes: https://bugs.gentoo.org/962045 Signed-off-by: Sam James <sam <AT> gentoo.org> sys-fs/zfs/files/2.3.4-musl.patch | 80 +++++++++++++++++++++++++++++++++++++++ sys-fs/zfs/zfs-2.3.4.ebuild | 1 + sys-fs/zfs/zfs-2.4.0_rc1.ebuild | 1 + 3 files changed, 82 insertions(+) diff --git a/sys-fs/zfs/files/2.3.4-musl.patch b/sys-fs/zfs/files/2.3.4-musl.patch new file mode 100644 index 000000000000..1b2a4d63d270 --- /dev/null +++ b/sys-fs/zfs/files/2.3.4-musl.patch @@ -0,0 +1,80 @@ +https://github.com/openzfs/zfs/pull/17675 +https://bugs.gentoo.org/962045 + +From 0f90c740b0264512cd1eea611a3c3571fb68d9c7 Mon Sep 17 00:00:00 2001 +From: classabbyamp <[email protected]> +Date: Wed, 27 Aug 2025 09:14:55 -0400 +Subject: [PATCH] linux: use sys/stat.h instead of linux/stat.h + +glibc includes linux/stat.h for statx, but musl defines its own statx +struct and associated constants, which does not include STATX_MNT_ID +yet. Thus, including linux/stat.h directly should be avoided for +maximum libc compatibility. + +Tested on: + - glibc: x86_64, i686, aarch64, armv7l, armv6l + - musl: x86_64, aarch64, armv7l, armv6l + +Signed-off-by: classabbyamp <[email protected]> +--- + config/user-statx.m4 | 6 +++--- + include/os/linux/spl/sys/stat.h | 2 +- + lib/libspl/include/os/linux/sys/stat.h | 2 +- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/config/user-statx.m4 b/config/user-statx.m4 +index 0315f93e0c20..1ba74a40e9b8 100644 +--- a/config/user-statx.m4 ++++ b/config/user-statx.m4 +@@ -2,7 +2,7 @@ dnl # + dnl # Check for statx() function and STATX_MNT_ID availability + dnl # + AC_DEFUN([ZFS_AC_CONFIG_USER_STATX], [ +- AC_CHECK_HEADERS([linux/stat.h], ++ AC_CHECK_HEADERS([sys/stat.h], + [have_stat_headers=yes], + [have_stat_headers=no]) + +@@ -14,7 +14,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_STATX], [ + AC_MSG_CHECKING([for STATX_MNT_ID]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +- #include <linux/stat.h> ++ #include <sys/stat.h> + ]], [[ + struct statx stx; + int mask = STATX_MNT_ID; +@@ -29,6 +29,6 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_STATX], [ + ]) + ]) + ], [ +- AC_MSG_WARN([linux/stat.h not found; skipping statx support]) ++ AC_MSG_WARN([sys/stat.h not found; skipping statx support]) + ]) + ]) dnl end AC_DEFUN +diff --git a/include/os/linux/spl/sys/stat.h b/include/os/linux/spl/sys/stat.h +index 087389b57b34..ad2815e46394 100644 +--- a/include/os/linux/spl/sys/stat.h ++++ b/include/os/linux/spl/sys/stat.h +@@ -25,6 +25,6 @@ + #ifndef _SPL_STAT_H + #define _SPL_STAT_H + +-#include <linux/stat.h> ++#include <sys/stat.h> + + #endif /* SPL_STAT_H */ +diff --git a/lib/libspl/include/os/linux/sys/stat.h b/lib/libspl/include/os/linux/sys/stat.h +index a605af962a6d..13cc0b46ac93 100644 +--- a/lib/libspl/include/os/linux/sys/stat.h ++++ b/lib/libspl/include/os/linux/sys/stat.h +@@ -33,7 +33,7 @@ + + #ifdef HAVE_STATX + #include <fcntl.h> +-#include <linux/stat.h> ++#include <sys/stat.h> + #endif + + /* + diff --git a/sys-fs/zfs/zfs-2.3.4.ebuild b/sys-fs/zfs/zfs-2.3.4.ebuild index 0f03de4f3713..80378219ff1f 100644 --- a/sys-fs/zfs/zfs-2.3.4.ebuild +++ b/sys-fs/zfs/zfs-2.3.4.ebuild @@ -111,6 +111,7 @@ RESTRICT="test" PATCHES=( "${FILESDIR}"/2.1.5-dracut-zfs-missing.patch + "${FILESDIR}"/2.3.4-musl.patch ) pkg_pretend() { diff --git a/sys-fs/zfs/zfs-2.4.0_rc1.ebuild b/sys-fs/zfs/zfs-2.4.0_rc1.ebuild index 0f03de4f3713..80378219ff1f 100644 --- a/sys-fs/zfs/zfs-2.4.0_rc1.ebuild +++ b/sys-fs/zfs/zfs-2.4.0_rc1.ebuild @@ -111,6 +111,7 @@ RESTRICT="test" PATCHES=( "${FILESDIR}"/2.1.5-dracut-zfs-missing.patch + "${FILESDIR}"/2.3.4-musl.patch ) pkg_pretend() {
