commit: e11cefa0a99c678c4f7676cbea9ad2951da862a5 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> AuthorDate: Tue Dec 9 17:52:42 2025 +0000 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> CommitDate: Tue Dec 9 17:52:42 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e11cefa0
media-libs/alsa-lib: fix build on musl Closes: https://bugs.gentoo.org/967250 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org> ...lib-1.2.15.ebuild => alsa-lib-1.2.15-r1.ebuild} | 1 + .../alsa-lib/files/alsa-lib-1.2.15-closefrom.patch | 97 ++++++++++++++++++++++ 2 files changed, 98 insertions(+) diff --git a/media-libs/alsa-lib/alsa-lib-1.2.15.ebuild b/media-libs/alsa-lib/alsa-lib-1.2.15-r1.ebuild similarity index 98% rename from media-libs/alsa-lib/alsa-lib-1.2.15.ebuild rename to media-libs/alsa-lib/alsa-lib-1.2.15-r1.ebuild index e2a403a46d9c..03418992c363 100644 --- a/media-libs/alsa-lib/alsa-lib-1.2.15.ebuild +++ b/media-libs/alsa-lib/alsa-lib-1.2.15-r1.ebuild @@ -34,6 +34,7 @@ BDEPEND="doc? ( >=app-text/doxygen-1.2.6 )" PATCHES=( "${FILESDIR}/${PN}-1.1.6-missing_files.patch" # bug #652422 + "${FILESDIR}/alsa-lib-1.2.15-closefrom.patch" ) pkg_setup() { diff --git a/media-libs/alsa-lib/files/alsa-lib-1.2.15-closefrom.patch b/media-libs/alsa-lib/files/alsa-lib-1.2.15-closefrom.patch new file mode 100644 index 000000000000..93de9f8153d8 --- /dev/null +++ b/media-libs/alsa-lib/files/alsa-lib-1.2.15-closefrom.patch @@ -0,0 +1,97 @@ +https://bugs.gentoo.org/967250 +https://github.com/alsa-project/alsa-lib/pull/486 + +From a068cf08ad67447893b707cddfce31c9cafee643 Mon Sep 17 00:00:00 2001 +From: Mike Gilbert <[email protected]> +Date: Mon, 8 Dec 2025 23:46:17 -0500 +Subject: [PATCH] ucm: use closefrom instead of close_range + +closefrom is a library function with a fallback mechanism for when the +kernel does not support the close_range syscall. + +Also check for the function properly instead of assuming it is available +with _GNU_SOURCE defined. + +Closes: https://github.com/alsa-project/alsa-lib/pull/486 +Fixes: https://github.com/alsa-project/alsa-lib/issues/485 +Signed-off-by: Mike Gilbert <[email protected]> +Signed-off-by: Jaroslav Kysela <[email protected]> +--- + configure.ac | 1 + + src/ucm/ucm_exec.c | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 8f4bd0de1..f4862f64c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -52,6 +52,7 @@ dnl Checks for library functions. + AC_PROG_GCC_TRADITIONAL + AC_CHECK_FUNCS([uselocale]) + AC_CHECK_FUNCS([eaccess]) ++AC_CHECK_DECLS([closefrom]) + + dnl Enable largefile support + AC_SYS_LARGEFILE +diff --git a/src/ucm/ucm_exec.c b/src/ucm/ucm_exec.c +index b5a22023b..713039b49 100644 +--- a/src/ucm/ucm_exec.c ++++ b/src/ucm/ucm_exec.c +@@ -259,8 +259,8 @@ int uc_mgr_exec(const char *prog) + + close(f); + +-#if defined(_GNU_SOURCE) +- close_range(3, maxfd, 0); ++#if HAVE_DECL_CLOSEFROM ++ closefrom(3); + #else + for (f = 3; f < maxfd; f++) + close(f); +From 813ffe34ff6c720dcc56e4549338bf9e9184af1f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela <[email protected]> +Date: Tue, 9 Dec 2025 17:48:34 +0100 +Subject: [PATCH] ucm: exec - fix maxfd used warning + +Fixes: a068cf08 ("ucm: use closefrom instead of close_range") +Signed-off-by: Jaroslav Kysela <[email protected]> +--- + src/ucm/ucm_exec.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/src/ucm/ucm_exec.c b/src/ucm/ucm_exec.c +index 713039b4..c16a4cfd 100644 +--- a/src/ucm/ucm_exec.c ++++ b/src/ucm/ucm_exec.c +@@ -183,7 +183,7 @@ static int parse_args(char ***argv, int argc, const char *cmd) + */ + int uc_mgr_exec(const char *prog) + { +- pid_t p, f, maxfd; ++ pid_t p, f; + int err = 0, status; + char bin[PATH_MAX]; + struct sigaction sa; +@@ -212,8 +212,6 @@ int uc_mgr_exec(const char *prog) + prog = bin; + } + +- maxfd = sysconf(_SC_OPEN_MAX); +- + /* + * block SIGCHLD signal + * ignore SIGINT and SIGQUIT in parent +@@ -262,8 +260,11 @@ int uc_mgr_exec(const char *prog) + #if HAVE_DECL_CLOSEFROM + closefrom(3); + #else +- for (f = 3; f < maxfd; f++) +- close(f); ++ { ++ pid_t maxfd = sysconf(_SC_OPEN_MAX); ++ for (f = 3; f < maxfd; f++) ++ close(f); ++ } + #endif + + /* install default handlers for the forked process */
