commit: 8c128ff779a89ca0f9559f72e23a43db15058583 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> AuthorDate: Mon Jun 10 16:19:28 2024 +0000 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> CommitDate: Mon Jun 10 16:19:28 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c128ff7
sys-apps/systemd-utils: fix sysusers on musl Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org> .../files/systemd-utils-255-musl-fgetxxent.patch | 61 ++++++++++++++++++++++ ...5.7-r1.ebuild => systemd-utils-255.7-r2.ebuild} | 1 + 2 files changed, 62 insertions(+) diff --git a/sys-apps/systemd-utils/files/systemd-utils-255-musl-fgetxxent.patch b/sys-apps/systemd-utils/files/systemd-utils-255-musl-fgetxxent.patch new file mode 100644 index 000000000000..682c0c7c21af --- /dev/null +++ b/sys-apps/systemd-utils/files/systemd-utils-255-musl-fgetxxent.patch @@ -0,0 +1,61 @@ +https://github.com/systemd/systemd/pull/33252 + +From 85277a97b222ce19cf951d2c99b1693e8c34fc45 Mon Sep 17 00:00:00 2001 +From: Mike Gilbert <[email protected]> +Date: Fri, 7 Jun 2024 12:28:41 -0400 +Subject: [PATCH] user-util: fix fgetxxent_sane on musl + +musl's implementation does not set errno to ENOENT when the end of file +is reached. It returns NULL and leaves errno unchanged. +--- + src/basic/user-util.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/basic/user-util.c b/src/basic/user-util.c +index b3df413be6b06..6bdf5bf1cdc9a 100644 +--- a/src/basic/user-util.c ++++ b/src/basic/user-util.c +@@ -977,8 +977,8 @@ int fgetpwent_sane(FILE *stream, struct passwd **pw) { + + errno = 0; + struct passwd *p = fgetpwent(stream); +- if (!p && errno != ENOENT) +- return errno_or_else(EIO); ++ if (!p && !IN_SET(errno, 0, ENOENT)) ++ return -errno; + + *pw = p; + return !!p; +@@ -990,8 +990,8 @@ int fgetspent_sane(FILE *stream, struct spwd **sp) { + + errno = 0; + struct spwd *s = fgetspent(stream); +- if (!s && errno != ENOENT) +- return errno_or_else(EIO); ++ if (!s && !IN_SET(errno, 0, ENOENT)) ++ return -errno; + + *sp = s; + return !!s; +@@ -1003,8 +1003,8 @@ int fgetgrent_sane(FILE *stream, struct group **gr) { + + errno = 0; + struct group *g = fgetgrent(stream); +- if (!g && errno != ENOENT) +- return errno_or_else(EIO); ++ if (!g && !IN_SET(errno, 0, ENOENT)) ++ return -errno; + + *gr = g; + return !!g; +@@ -1017,8 +1017,8 @@ int fgetsgent_sane(FILE *stream, struct sgrp **sg) { + + errno = 0; + struct sgrp *s = fgetsgent(stream); +- if (!s && errno != ENOENT) +- return errno_or_else(EIO); ++ if (!s && !IN_SET(errno, 0, ENOENT)) ++ return -errno; + + *sg = s; + return !!s; diff --git a/sys-apps/systemd-utils/systemd-utils-255.7-r1.ebuild b/sys-apps/systemd-utils/systemd-utils-255.7-r2.ebuild similarity index 99% rename from sys-apps/systemd-utils/systemd-utils-255.7-r1.ebuild rename to sys-apps/systemd-utils/systemd-utils-255.7-r2.ebuild index 0d6be4c5b60d..5eada6a19240 100644 --- a/sys-apps/systemd-utils/systemd-utils-255.7-r1.ebuild +++ b/sys-apps/systemd-utils/systemd-utils-255.7-r2.ebuild @@ -132,6 +132,7 @@ pkg_setup() { src_prepare() { local PATCHES=( + "${FILESDIR}/systemd-utils-255-musl-fgetxxent.patch" ) if use elibc_musl; then
