From 826d4fe4297c56657689e6b6efb867f02db12ff5 Mon Sep 17 00:00:00 2001 From: CNE <8430237+canoine@users.noreply.github.com> Date: Wed, 13 May 2026 08:35:30 +0200 Subject: [PATCH] Add patches The gentoo repo ones --- .../elogind/files/elogind-252.9-nodocs.patch | 28 ++++++ .../files/elogind-255.17-revert-s2idle.patch | 55 ++++++++++++ .../files/elogind-255.22-musl-deux.patch | 54 ++++++++++++ .../elogind/files/elogind-255.22-musl.patch | 86 +++++++++++++++++++ sys-auth/elogind/files/elogind.init-r1 | 27 ++++++ 5 files changed, 250 insertions(+) create mode 100644 sys-auth/elogind/files/elogind-252.9-nodocs.patch create mode 100644 sys-auth/elogind/files/elogind-255.17-revert-s2idle.patch create mode 100644 sys-auth/elogind/files/elogind-255.22-musl-deux.patch create mode 100644 sys-auth/elogind/files/elogind-255.22-musl.patch create mode 100644 sys-auth/elogind/files/elogind.init-r1 diff --git a/sys-auth/elogind/files/elogind-252.9-nodocs.patch b/sys-auth/elogind/files/elogind-252.9-nodocs.patch new file mode 100644 index 0000000..4be92f9 --- /dev/null +++ b/sys-auth/elogind/files/elogind-252.9-nodocs.patch @@ -0,0 +1,28 @@ +diff --git a/meson.build b/meson.build +index 694a2fd97..9b97cafef 100644 +--- a/meson.build ++++ b/meson.build +@@ -4528,15 +4528,11 @@ subdir('shell-completion/zsh') + # install_dir : xinitrcdir) + # endif + #endif // 0 +-install_data('LICENSE.GPL2', +- 'LICENSE.LGPL2.1', + #if 0 /// elogind has upgraded to markdown, and the NEWS file is useless + # 'NEWS', + # 'README', + #else // 0 +- 'README.md', + #endif // 0 +- 'docs/CODING_STYLE.md', + #if 0 /// irrelevant for elogind + # 'docs/DISTRO_PORTING.md', + # 'docs/ENVIRONMENT.md', +@@ -4545,7 +4541,6 @@ install_data('LICENSE.GPL2', + # 'docs/TRANSLATORS.md', + # 'docs/UIDS-GIDS.md', + #endif // 0 +- install_dir : docdir) + + #if 0 /// irrelevant for elogind + # install_subdir('LICENSES', diff --git a/sys-auth/elogind/files/elogind-255.17-revert-s2idle.patch b/sys-auth/elogind/files/elogind-255.17-revert-s2idle.patch new file mode 100644 index 0000000..053e5f9 --- /dev/null +++ b/sys-auth/elogind/files/elogind-255.17-revert-s2idle.patch @@ -0,0 +1,55 @@ +From 484126708da24d1611cb0697c6e3a20088b1a839 Mon Sep 17 00:00:00 2001 +From: Andreas Sturmlechner +Date: Tue, 12 Nov 2024 23:43:16 +0100 +Subject: [PATCH] Revert "Re-Add sleep mode configuration" + +This reverts commit 7707a30dfb2496a4c9c5939f0dd8bb39baebfecd. + +sleep.donf.d/10-elogind.conf: Revert set SuspendMode=s2idle deep + +This reverts a tiny part of commit c5e7ba0c47ae95e2cf6fd48dc9353e8f333200c4. +--- + src/shared/sleep-config.c | 8 -------- + src/sleep/10-elogind.conf | 1 - + 2 files changed, 9 deletions(-) + +diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c +index 941a013eb..27f2fcd76 100644 +--- a/src/shared/sleep-config.c ++++ b/src/shared/sleep-config.c +@@ -42,11 +42,7 @@ static char* const* const sleep_default_state_table[_SLEEP_OPERATION_CONFIG_MAX] + }; + + static char* const* const sleep_default_mode_table[_SLEEP_OPERATION_CONFIG_MAX] = { +-#if 0 /// elogind supports suspend modes (deep s2idle) so we need defaults, too + /* Not used by SLEEP_SUSPEND */ +-#else // 0 +- [SLEEP_SUSPEND] = STRV_MAKE("deep", "s2idle"), +-#endif // 0 + [SLEEP_HIBERNATE] = STRV_MAKE("platform", "shutdown"), + [SLEEP_HYBRID_SLEEP] = STRV_MAKE("suspend"), + }; +@@ -172,11 +168,7 @@ int parse_sleep_config(SleepConfig **ret) { + { "Sleep", "AllowHybridSleep", config_parse_tristate, 0, &allow_hybrid_sleep }, + + { "Sleep", "SuspendState", config_parse_strv, 0, sc->states + SLEEP_SUSPEND }, +-#if 0 /// elogind does support suspend modes + { "Sleep", "SuspendMode", config_parse_warn_compat, DISABLED_LEGACY, NULL }, +-#else // 0 +- { "Sleep", "SuspendMode", config_parse_sleep_mode, 0, sc->modes + SLEEP_SUSPEND }, +-#endif // 0 + + { "Sleep", "HibernateState", config_parse_warn_compat, DISABLED_LEGACY, NULL }, + { "Sleep", "HibernateMode", config_parse_sleep_mode, 0, sc->modes + SLEEP_HIBERNATE }, +diff --git a/src/sleep/10-elogind.conf b/src/sleep/10-elogind.conf +index 4d4e29bea..6c9cbd477 100644 +--- a/src/sleep/10-elogind.conf ++++ b/src/sleep/10-elogind.conf +@@ -19,4 +19,3 @@ + #HandleNvidiaSleep=no + #HibernateByUsing= + #SuspendByUsing= +-#SuspendMode=deep s2idle +-- +2.51.2 + diff --git a/sys-auth/elogind/files/elogind-255.22-musl-deux.patch b/sys-auth/elogind/files/elogind-255.22-musl-deux.patch new file mode 100644 index 0000000..a64e726 --- /dev/null +++ b/sys-auth/elogind/files/elogind-255.22-musl-deux.patch @@ -0,0 +1,54 @@ +https://bugs.gentoo.org/967711#c5 + +From 182f0406205b2d9302f555a1afb52d6f70dc488e Mon Sep 17 00:00:00 2001 +From: "David C. Manuelda" +Date: Sun, 19 Apr 2026 23:31:25 +0200 +Subject: [PATCH] Musl fixes + +--- + src/basic/missing_prctl.h | 3 +++ + src/libelogind/sd-journal/journal-file.h | 1 + + src/shared/user-record-nss.h | 1 - + 3 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h +index 7d9e395..80d9af3 100644 +--- a/src/basic/missing_prctl.h ++++ b/src/basic/missing_prctl.h +@@ -1,7 +1,10 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + #pragma once + ++#include ++#ifndef PR_SET_MM_MAP + #include ++#endif + + /* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */ + #ifndef PR_CAP_AMBIENT +diff --git a/src/libelogind/sd-journal/journal-file.h b/src/libelogind/sd-journal/journal-file.h +index c3c5f59..3e62495 100644 +--- a/src/libelogind/sd-journal/journal-file.h ++++ b/src/libelogind/sd-journal/journal-file.h +@@ -3,6 +3,7 @@ + + #include + #include ++#include + //#include + + #if HAVE_GCRYPT +diff --git a/src/shared/user-record-nss.h b/src/shared/user-record-nss.h +index 7a41be7..3a970a6 100644 +--- a/src/shared/user-record-nss.h ++++ b/src/shared/user-record-nss.h +@@ -2,7 +2,6 @@ + #pragma once + + #include +-#include + #include + #include + +-- +2.53.0 diff --git a/sys-auth/elogind/files/elogind-255.22-musl.patch b/sys-auth/elogind/files/elogind-255.22-musl.patch new file mode 100644 index 0000000..38a68be --- /dev/null +++ b/sys-auth/elogind/files/elogind-255.22-musl.patch @@ -0,0 +1,86 @@ +https://github.com/elogind/elogind/commit/c09b9caece0459ec56b234a87583e1bfac3c3271 + +From c09b9caece0459ec56b234a87583e1bfac3c3271 Mon Sep 17 00:00:00 2001 +From: Sven Eden +Date: Thu, 20 Nov 2025 08:12:12 +0100 +Subject: [PATCH] journal-send.c, bus-error.c: Fix strerror_r handling for + non-GLIBC systems + +Fix the handling of `strerror_r` in non-GLIBC systems to ensure compatibility. + +- Handle `strerror_r` differently for non-GLIBC systems in `journal-send.c`. +- Handle `strerror_r` differently for non-GLIBC systems in `bus-error.c`. +- Remove redundant definition of `strerror_r` from `musl_missing.h`. + +This change ensures that the `strerror_r` function behaves correctly across different environments, particularly on systems using the musl C library. + +Bug: #320 +Closes: #320 +Signed-off-by: Sven Eden +--- + src/basic/musl_missing.h | 2 -- + src/libelogind/sd-bus/bus-error.c | 10 ++++++++++ + src/libelogind/sd-journal/journal-send.c | 5 +++++ + 3 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/src/basic/musl_missing.h b/src/basic/musl_missing.h +index d8a5bff222..3f592f1c6f 100644 +--- a/src/basic/musl_missing.h ++++ b/src/basic/musl_missing.h +@@ -26,8 +26,6 @@ void elogind_set_program_name(const char* pcall); + #include + #include /* for pthread_atfork */ + +-#define strerror_r(e, m, k) (strerror_r(e, m, k) < 0 ? strdup("strerror_r() failed") : m); +- + /* + * Possibly TODO according to http://man7.org/linux/man-pages/man3/getenv.3.html + * + test if the process's effective user ID does not match its real user ID or +diff --git a/src/libelogind/sd-bus/bus-error.c b/src/libelogind/sd-bus/bus-error.c +index 58c24d25c0..4895bd3c66 100644 +--- a/src/libelogind/sd-bus/bus-error.c ++++ b/src/libelogind/sd-bus/bus-error.c +@@ -405,7 +405,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) { + return; + + errno = 0; ++#ifndef __GLIBC__ ++ strerror_r(error, m, k); ++ x = m; ++#else // __GLIBC__ + x = strerror_r(error, m, k); ++#endif // __GLIBC__ + if (errno == ERANGE || strlen(x) >= k - 1) { + free(m); + k *= 2; +@@ -591,7 +596,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static + if (e && e->message) + return e->message; + ++#ifndef __GLIBC__ ++ strerror_r(abs(error), buf, ERRNO_BUF_LEN); ++ return buf; ++#else // __GLIBC__ + return strerror_r(abs(error), buf, ERRNO_BUF_LEN); ++#endif // __GLIBC__ + } + + static bool map_ok(const sd_bus_error_map *map) { +diff --git a/src/libelogind/sd-journal/journal-send.c b/src/libelogind/sd-journal/journal-send.c +index f0a0190a5b..6bfa2211f3 100644 +--- a/src/libelogind/sd-journal/journal-send.c ++++ b/src/libelogind/sd-journal/journal-send.c +@@ -424,7 +424,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove + char* j; + + errno = 0; ++#ifndef __GLIBC__ ++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); ++ j = buffer + 8 + k; ++#else // __GLIBC__ + j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); ++#endif // __GLIBC__ + if (errno == 0) { + char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1]; + + diff --git a/sys-auth/elogind/files/elogind.init-r1 b/sys-auth/elogind/files/elogind.init-r1 new file mode 100644 index 0000000..1cb5071 --- /dev/null +++ b/sys-auth/elogind/files/elogind.init-r1 @@ -0,0 +1,27 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need dbus + + # Make sure elogind is up before xdm starts any dm + before xdm + + use logger +} + +start() { + ebegin "Starting elogind" + + start-stop-daemon --start --quiet \ + --pidfile "${ELOGIND_PIDFILE}" \ + --exec "${ELOGIND_EXEC}" -- --daemon + eend $? +} + +stop() { + ebegin "Stopping elogind" + start-stop-daemon --stop --quiet --pidfile "${ELOGIND_PIDFILE}" + eend $? +}