commit: 418d9019df4b247d64b7c4665ba2805e5a06928f Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> AuthorDate: Sat Oct 25 06:38:52 2025 +0000 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> CommitDate: Sat Oct 25 06:38:52 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=418d9019
dev-libs/confuse: EAPI=8, add some good upstream fixes Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org> dev-libs/confuse/confuse-3.3-r3.ebuild | 63 ++++++++++++++++++++++++ dev-libs/confuse/files/confuse-3.3-isspace.patch | 38 ++++++++++++++ dev-libs/confuse/files/confuse-3.3-lfs.patch | 31 ++++++++++++ 3 files changed, 132 insertions(+) diff --git a/dev-libs/confuse/confuse-3.3-r3.ebuild b/dev-libs/confuse/confuse-3.3-r3.ebuild new file mode 100644 index 000000000000..8e3b23fb8b7f --- /dev/null +++ b/dev-libs/confuse/confuse-3.3-r3.ebuild @@ -0,0 +1,63 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit multilib-minimal + +DESCRIPTION="a configuration file parser library" +HOMEPAGE="https://github.com/libconfuse/libconfuse" +SRC_URI="https://github.com/libconfuse/libconfuse/releases/download/v${PV}/${P}.tar.xz" + +LICENSE="ISC" +SLOT="0/2.1.0" +KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos" + +IUSE="nls static-libs" + +BDEPEND=" + app-alternatives/lex + dev-build/libtool + virtual/pkgconfig + nls? ( sys-devel/gettext ) +" +RDEPEND=" + nls? ( virtual/libintl[${MULTILIB_USEDEP}] ) +" + +PATCHES=( + # Upstream commit to fix CVE-2022-40320: + # https://github.com/libconfuse/libconfuse/commit/d73777c2c3566fb2647727bb56d9a2295b81669b + "${FILESDIR}"/confuse-3.3-fix-CVE-2022-40320.patch + # https://github.com/libconfuse/libconfuse/pull/167 + "${FILESDIR}"/confuse-3.3-lfs.patch + # https://github.com/libconfuse/libconfuse/pull/181 + "${FILESDIR}"/confuse-3.3-isspace.patch +) + +DOCS=( AUTHORS ) + +src_prepare() { + default + multilib_copy_sources +} + +multilib_src_configure() { + # examples are normally compiled but not installed. They + # fail during a mingw crosscompile. + local ECONF_SOURCE=${BUILD_DIR} + econf \ + --disable-examples \ + $(use_enable nls) \ + $(use_enable static-libs static) +} + +multilib_src_install_all() { + doman doc/man/man3/*.3 + dodoc -r doc/html + + docinto examples + dodoc examples/*.{c,conf} + + find "${D}" -name '*.la' -type f -delete || die +} diff --git a/dev-libs/confuse/files/confuse-3.3-isspace.patch b/dev-libs/confuse/files/confuse-3.3-isspace.patch new file mode 100644 index 000000000000..99337a858549 --- /dev/null +++ b/dev-libs/confuse/files/confuse-3.3-isspace.patch @@ -0,0 +1,38 @@ +https://github.com/libconfuse/libconfuse/commit/dc7cef956d6d7c1ec792f9561f732797b52e92d4 +From: Thomas Klausner <[email protected]> +Date: Mon, 5 May 2025 23:22:51 +0200 +Subject: [PATCH] Fix isspace() arguments. + +Per ANSI and POSIX, isspace() only accepts arguments that +are valid 'unsigned char' or EOF. + +The code passed 'char' arguments, which on many platforms are +'signed char'. These are automatically promoted to integers, keeping +the sign, so negative values like -61 are passed to isspace(), +which is not allowed per the standards. + +Casting to 'unsigned char' makes sure the isspace argument is in the +allowed range. + +Fixes core dump e.g. in i3status. + +Closes #180. +--- a/src/lexer.l ++++ b/src/lexer.l +@@ -397,14 +397,14 @@ static char *trim_whitespace(char *str, unsigned int len) + return str; + + while (len > 1) { +- if ((str[len] == 0 || isspace(str[len])) && isspace(str[len - 1])) ++ if ((str[len] == 0 || isspace((unsigned char)str[len])) && isspace((unsigned char)str[len - 1])) + len--; + else + break; + } + str[len] = 0; + +- while (isspace(*str)) ++ while (isspace((unsigned char)*str)) + str++; + + return str; diff --git a/dev-libs/confuse/files/confuse-3.3-lfs.patch b/dev-libs/confuse/files/confuse-3.3-lfs.patch new file mode 100644 index 000000000000..7b8cd461bdc0 --- /dev/null +++ b/dev-libs/confuse/files/confuse-3.3-lfs.patch @@ -0,0 +1,31 @@ +https://github.com/libconfuse/libconfuse/commit/e967a307bf570306acd949513559e044b0da1f2d +From: Mike Frysinger <[email protected]> +Date: Tue, 10 Jan 2023 14:03:09 -0500 +Subject: [PATCH] configure.ac: enable automatic LFS support + +Automatically enable large filesystem support so we use the newer +interfaces when interacting with the filesystem. Without this, +code that tries to stat a file with 64-bit inodes can fail if the +stat structure is only 32-bit (which is common on x86 & arm). On +Linux, this can manifest with some filesystems more often than +others. + +Practically speaking, since libconfuse doesn't do too much file +I/O, the overhead should be non-existent. Especially since the +C library (e.g. glibc) is already using the 64-bit syscall even +if the function call was 32-bit. + +On systems that have 64-bit stat already (which is common on x86_64 +and aarch64), there is no overhead as the code is exactly the same. +--- a/configure.ac ++++ b/configure.ac +@@ -31,6 +31,9 @@ AM_GNU_GETTEXT([external]) + AM_GNU_GETTEXT_VERSION([0.19.6]) + AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.6]) + ++# Checks for OS settings. ++AC_SYS_LARGEFILE ++ + # Checks for header files. + AC_HEADER_STDC + AC_CHECK_HEADERS([unistd.h string.h strings.h sys/stat.h windows.h])
