commit:     c8ab460a425d7faede694e9738f4663d73b3540c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 12 01:59:19 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 12 02:01:34 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8ab460a

sys-fs/xfsprogs: fix quota regression in 6.17.0

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-fs/xfsprogs/files/xfsprogs-6.17.0-ioctl.patch |  66 +++++++++++++
 sys-fs/xfsprogs/xfsprogs-6.17.0-r1.ebuild         | 114 ++++++++++++++++++++++
 2 files changed, 180 insertions(+)

diff --git a/sys-fs/xfsprogs/files/xfsprogs-6.17.0-ioctl.patch 
b/sys-fs/xfsprogs/files/xfsprogs-6.17.0-ioctl.patch
new file mode 100644
index 000000000000..70c7cdb6fec8
--- /dev/null
+++ b/sys-fs/xfsprogs/files/xfsprogs-6.17.0-ioctl.patch
@@ -0,0 +1,66 @@
+https://lore.kernel.org/linux-xfs/[email protected]/
+https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/commit/?h=for-next&id=3147d1d643c8278f1b75dedf3a64037bece7da53
+
+From 3147d1d643c8278f1b75dedf3a64037bece7da53 Mon Sep 17 00:00:00 2001
+From: Arkadiusz Miśkiewicz <[email protected]>
+Date: Fri, 5 Dec 2025 15:31:48 +0100
+Subject: libfrog: fix incorrect FS_IOC_FSSETXATTR argument to ioctl()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+xfsprogs 6.17.0 has broken project quota due to incorrect argument
+passed to FS_IOC_FSSETXATTR ioctl(). Instead of passing struct fsxattr,
+struct file_attr was passed.
+
+# LC_ALL=C /usr/sbin/xfs_quota -x -c "project -s -p /home/xxx 389701" /home
+Setting up project 389701 (path /home/xxx)...
+xfs_quota: cannot set project on /home/xxx: Invalid argument
+Processed 1 (/etc/projects and cmdline) paths for project 389701 with
+recursion depth infinite (-1).
+
+ioctl(5, FS_IOC_FSSETXATTR, {fsx_xflags=FS_XFLAG_PROJINHERIT|FS_XFLAG_HASATTR, 
fsx_extsize=0, fsx_projid=0, fsx_cowextsize=389701}) = -1 EINVAL (Invalid 
argument)
+
+There seems to be a double mistake which hides the original ioctl()
+argument bug on old kernel with xfsprogs built against it. The size of
+fa_xflags was also wrong in xfsprogs's linux.h header. This way when
+xfsprogs is compiled on newer kernel but used with older kernel this bug
+uncovers.
+
+Reviewed-by: Darrick J. Wong <[email protected]>
+Reviewed-by: Christoph Hellwig <[email protected]>
+Signed-off-by: Arkadiusz Miśkiewicz <[email protected]>
+Signed-off-by: Andrey Albershteyn <[email protected]>
+---
+ include/linux.h     | 2 +-
+ libfrog/file_attr.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/linux.h b/include/linux.h
+index cea468d2b9..3ea9016272 100644
+--- a/include/linux.h
++++ b/include/linux.h
+@@ -214,7 +214,7 @@ struct fsxattr {
+  * fsxattr
+  */
+ struct file_attr {
+-      __u32   fa_xflags;
++      __u64   fa_xflags;
+       __u32   fa_extsize;
+       __u32   fa_nextents;
+       __u32   fa_projid;
+diff --git a/libfrog/file_attr.c b/libfrog/file_attr.c
+index c2cbcb4e14..6801c54588 100644
+--- a/libfrog/file_attr.c
++++ b/libfrog/file_attr.c
+@@ -114,7 +114,7 @@ xfrog_file_setattr(
+ 
+       file_attr_to_fsxattr(fa, &fsxa);
+ 
+-      error = ioctl(fd, FS_IOC_FSSETXATTR, fa);
++      error = ioctl(fd, FS_IOC_FSSETXATTR, &fsxa);
+       close(fd);
+ 
+       return error;
+-- 
+cgit 1.2.3-korg

diff --git a/sys-fs/xfsprogs/xfsprogs-6.17.0-r1.ebuild 
b/sys-fs/xfsprogs/xfsprogs-6.17.0-r1.ebuild
new file mode 100644
index 000000000000..6df2f7dc0283
--- /dev/null
+++ b/sys-fs/xfsprogs/xfsprogs-6.17.0-r1.ebuild
@@ -0,0 +1,114 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic systemd udev
+
+DESCRIPTION="XFS filesystem utilities"
+HOMEPAGE="https://xfs.wiki.kernel.org/ 
https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/";
+SRC_URI="https://www.kernel.org/pub/linux/utils/fs/xfs/${PN}/${P}.tar.xz";
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 
~sparc x86"
+IUSE="icu libedit nls selinux static-libs"
+
+RDEPEND="
+       dev-libs/inih
+       dev-libs/userspace-rcu:=
+       >=sys-apps/util-linux-2.17.2
+       icu? ( dev-libs/icu:= )
+       libedit? ( dev-libs/libedit )
+"
+DEPEND="
+       ${RDEPEND}
+       >=sys-kernel/linux-headers-6.11
+"
+BDEPEND="nls? ( sys-devel/gettext )"
+RDEPEND+=" selinux? ( sec-policy/selinux-xfs )"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-6.17.0-ioctl.patch
+)
+
+src_prepare() {
+       default
+
+       # Fix doc dir
+       sed -i \
+               -e "/^PKG_DOC_DIR/s:@pkg_name@:${PF}:" \
+               include/builddefs.in || die
+
+       # Don't install compressed docs
+       sed 's@\(CHANGES\)\.gz[[:space:]]@\1 @' -i doc/Makefile || die
+}
+
+src_configure() {
+       # include/builddefs.in will add FCFLAGS to CFLAGS which will
+       # unnecessarily clutter CFLAGS (and fortran isn't used)
+       unset FCFLAGS
+
+       # If set in user env, this breaks configure
+       unset PLATFORM
+
+       export DEBUG=-DNDEBUG
+
+       # Package is honoring CFLAGS; No need to use OPTIMIZER anymore.
+       # However, we have to provide an empty value to avoid default
+       # flags.
+       export OPTIMIZER=" "
+
+       # Avoid automagic on libdevmapper (bug #709694)
+       export ac_cv_search_dm_task_create=no
+
+       # bug 903611
+       use elibc_musl && append-flags -D_LARGEFILE64_SOURCE
+
+       # Upstream does NOT support --disable-static anymore,
+       # https://www.spinics.net/lists/linux-xfs/msg30185.html
+       # https://www.spinics.net/lists/linux-xfs/msg30272.html
+       local myconf=(
+               --enable-static
+               # Doesn't do anything beyond adding -flto (bug #930947).
+               --disable-lto
+               # The default value causes double 'lib'
+               --localstatedir="${EPREFIX}/var"
+               --with-crond-dir="${EPREFIX}/etc/cron.d"
+               --with-systemd-unit-dir="$(systemd_get_systemunitdir)"
+               --with-udev-rule-dir="$(get_udevdir)/rules.d"
+               $(use_enable icu libicu)
+               $(use_enable nls gettext)
+               $(use_enable libedit editline)
+       )
+
+       econf "${myconf[@]}"
+}
+
+src_compile() {
+       emake V=1
+}
+
+src_install() {
+       # XXX: There's a missing dep in the install-dev target, so split it
+       emake DIST_ROOT="${ED}" HAVE_ZIPPED_MANPAGES=false install
+       emake DIST_ROOT="${ED}" HAVE_ZIPPED_MANPAGES=false install-dev
+
+       # Not actually used but --localstatedir causes this empty dir
+       # to be installed.
+       rmdir "${ED}"/var/lib/xfsprogs "${ED}"/var/lib || die
+
+       if ! use static-libs; then
+               rm "${ED}/usr/$(get_libdir)/libhandle.a" || die
+       fi
+
+       find "${ED}" -name '*.la' -delete || die
+}
+
+pkg_postrm() {
+       udev_reload
+}
+
+pkg_postinst() {
+       udev_reload
+}

Reply via email to