From 894f42f4baf7096ee755b4dacc206121a94a4358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= Date: Wed, 5 Jul 2023 20:28:51 +0100 Subject: [PATCH] elogind: update to 252.9. --- srcpkgs/elogind/patches/SEEK_DATA.patch | 23 +++++ srcpkgs/elogind/patches/getdents.patch | 32 +++++++ srcpkgs/elogind/patches/gshadow.patch | 12 +++ srcpkgs/elogind/patches/id-nobody.patch | 1 - srcpkgs/elogind/patches/mips.patch | 11 --- srcpkgs/elogind/patches/polkit.patch | 27 ------ srcpkgs/elogind/patches/ppc64-bad-tuple.patch | 25 ------ srcpkgs/elogind/patches/ppcle.patch | 25 ------ srcpkgs/elogind/patches/rlim-max.patch | 14 +++ srcpkgs/elogind/patches/sigfillset.patch | 12 +++ srcpkgs/elogind/patches/statx.patch | 30 +++++++ srcpkgs/elogind/patches/strerror_r.patch | 90 +++++++++++++++++++ srcpkgs/elogind/patches/strerror_r_1.patch | 43 +++++++++ srcpkgs/elogind/template | 24 ++--- 14 files changed, 268 insertions(+), 101 deletions(-) create mode 100644 srcpkgs/elogind/patches/SEEK_DATA.patch create mode 100644 srcpkgs/elogind/patches/getdents.patch create mode 100644 srcpkgs/elogind/patches/gshadow.patch delete mode 100644 srcpkgs/elogind/patches/mips.patch delete mode 100644 srcpkgs/elogind/patches/polkit.patch delete mode 100644 srcpkgs/elogind/patches/ppc64-bad-tuple.patch delete mode 100644 srcpkgs/elogind/patches/ppcle.patch create mode 100644 srcpkgs/elogind/patches/rlim-max.patch create mode 100644 srcpkgs/elogind/patches/sigfillset.patch create mode 100644 srcpkgs/elogind/patches/statx.patch create mode 100644 srcpkgs/elogind/patches/strerror_r.patch create mode 100644 srcpkgs/elogind/patches/strerror_r_1.patch diff --git a/srcpkgs/elogind/patches/SEEK_DATA.patch b/srcpkgs/elogind/patches/SEEK_DATA.patch new file mode 100644 index 000000000000..01e1cfee6ecb --- /dev/null +++ b/srcpkgs/elogind/patches/SEEK_DATA.patch @@ -0,0 +1,23 @@ +Upstream:no + +Our musl version doesn't expose the SEEK_DATA and SEEK_HOLE in `unisted.h`... +Only version >= 1.2.3 do that. + +-- +diff --git a/src/shared/copy.h b/src/shared/copy.h +index a34a87c..60c63f8 100644 +--- a/src/shared/copy.h ++++ b/src/shared/copy.h +@@ -70,6 +70,12 @@ static inline int copy_bytes(int fdf, int fdt, uint64_t max_bytes, CopyFlags cop + return copy_bytes_full(fdf, fdt, max_bytes, copy_flags, NULL, NULL, NULL, NULL); + } + ++#ifndef __GLIBC__ ++#define SEEK_DATA 3 /* Seek to next data. */ ++#define SEEK_HOLE 4 /* Seek to next hole. */ ++#endif ++ ++ + #if 0 /// UNNEEDED by elogind + int copy_times(int fdf, int fdt, CopyFlags flags); + int copy_access(int fdf, int fdt); diff --git a/srcpkgs/elogind/patches/getdents.patch b/srcpkgs/elogind/patches/getdents.patch new file mode 100644 index 000000000000..485145f83eca --- /dev/null +++ b/srcpkgs/elogind/patches/getdents.patch @@ -0,0 +1,32 @@ +Upstream: no +Source: https://raw.githubusercontent.com/chimera-linux/cports/81f0a3c25df2a841c2d99d752e60296062bf7543/main/elogind/patches/getdents.patch + +From dab02796780f00d689cc1c7a0ba81abe7c5f28d0 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 21 Jan 2022 15:15:11 -0800 +Subject: [PATCH] pass correct parameters to getdents64 + +Fixes musl system only +../git/src/basic/recurse-dir.c:57:40: error: incompatible pointer types passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types] + n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +../git/src/basic/stat-util.c:102:28: error: incompatible pointer types passing 'union (unnamed union at ../git/src/basic/stat-util.c:78:9) *' to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types] + n = getdents64(fd, &buffer, sizeof(buffer)); + +diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c +index d16ca98..0480a69 100644 +--- a/src/basic/recurse-dir.c ++++ b/src/basic/recurse-dir.c +@@ -54,7 +54,11 @@ int readdir_all(int dir_fd, + bs = MIN(MALLOC_SIZEOF_SAFE(de) - offsetof(DirectoryEntries, buffer), (size_t) SSIZE_MAX); + assert(bs > de->buffer_size); + ++ #ifdef __GLIBC__ + n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size); ++ #else ++ n = getdents(dir_fd, (struct dirent*)((uint8_t*) de->buffer + de->buffer_size), bs - de->buffer_size); ++ #endif + if (n < 0) + return -errno; + if (n == 0) diff --git a/srcpkgs/elogind/patches/gshadow.patch b/srcpkgs/elogind/patches/gshadow.patch new file mode 100644 index 000000000000..a890917ddfe6 --- /dev/null +++ b/srcpkgs/elogind/patches/gshadow.patch @@ -0,0 +1,12 @@ +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 + diff --git a/srcpkgs/elogind/patches/id-nobody.patch b/srcpkgs/elogind/patches/id-nobody.patch index 5e9e5cdea979..ab892cd63f6a 100644 --- a/srcpkgs/elogind/patches/id-nobody.patch +++ b/srcpkgs/elogind/patches/id-nobody.patch @@ -10,4 +10,3 @@ +#define GID_NOBODY ((gid_t) 99U) #define ETC_PASSWD_LOCK_PATH "/etc/.pwd.lock" - diff --git a/srcpkgs/elogind/patches/mips.patch b/srcpkgs/elogind/patches/mips.patch deleted file mode 100644 index ca1c0974cb86..000000000000 --- a/srcpkgs/elogind/patches/mips.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/basic/missing_syscall.h 2021-01-15 08:12:02.000000000 +0100 -+++ b/src/basic/missing_syscall.h 2021-02-24 07:20:32.026355819 +0100 -@@ -11,7 +11,7 @@ - #include - #include - --#ifdef ARCH_MIPS -+#if defined(_MIPSEL) || defined(_MIPSEB) - #include - #endif - diff --git a/srcpkgs/elogind/patches/polkit.patch b/srcpkgs/elogind/patches/polkit.patch deleted file mode 100644 index 4bdf1289f268..000000000000 --- a/srcpkgs/elogind/patches/polkit.patch +++ /dev/null @@ -1,27 +0,0 @@ -commit 2b09e13f7aec13105380d9d9fddc96ae51911b0c -Author: Daniel Kolesa -Date: Sat Dec 18 02:53:26 2021 +0100 - - reenable polkit - -diff --git a/meson.build b/meson.build -index 72825a2..b14cb64 100644 ---- a/meson.build -+++ b/meson.build -@@ -1155,15 +1155,6 @@ if want_polkit != 'false' and not skip_deps - message('Old polkit detected, will install pkla files') - install_polkit_pkla = true - endif --#if 1 /// Disable polkit completely if libpolkit is not there. See elogind issue #167 -- if not libpolkit.found() -- if want_polkit != 'auto' -- error('Polkit requested but libpolkit was not found.') -- endif -- install_polkit = false -- want_polkit = false -- endif --#endif // 1 - endif - conf.set10('ENABLE_POLKIT', install_polkit) - - diff --git a/srcpkgs/elogind/patches/ppc64-bad-tuple.patch b/srcpkgs/elogind/patches/ppc64-bad-tuple.patch deleted file mode 100644 index f6237ffff45e..000000000000 --- a/srcpkgs/elogind/patches/ppc64-bad-tuple.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0ce8ef86e8bfc872b40bc090fea9873fa1f51836 Mon Sep 17 00:00:00 2001 -From: q66 -Date: Thu, 21 Jan 2021 22:22:28 +0100 -Subject: [PATCH] fix ppc64 arch tuple - ---- - src/basic/architecture.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git src/basic/architecture.h src/basic/architecture.h -index 620b522..3ea6e52 100644 ---- a/src/basic/architecture.h -+++ b/src/basic/architecture.h -@@ -77,7 +77,7 @@ int uname_architecture(void); - #elif defined(__powerpc64__) - # if __BYTE_ORDER == __BIG_ENDIAN - # define native_architecture() ARCHITECTURE_PPC64 --# define LIB_ARCH_TUPLE "ppc64-linux-gnu" -+# define LIB_ARCH_TUPLE "powerpc64-linux-gnu" - # define SECONDARY_ARCHITECTURE ARCHITECTURE_PPC - # else - # define native_architecture() ARCHITECTURE_PPC64_LE --- -2.30.0 - diff --git a/srcpkgs/elogind/patches/ppcle.patch b/srcpkgs/elogind/patches/ppcle.patch deleted file mode 100644 index b986b0f37db9..000000000000 --- a/srcpkgs/elogind/patches/ppcle.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 836f3efb84a703b3594906572a54616d25cecf5e Mon Sep 17 00:00:00 2001 -From: q66 -Date: Thu, 21 Jan 2021 21:59:12 +0100 -Subject: [PATCH] add ppcle arch tuple - ---- - src/basic/architecture.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git src/basic/architecture.h src/basic/architecture.h -index 620b522..afdff7a 100644 ---- a/src/basic/architecture.h -+++ b/src/basic/architecture.h -@@ -94,7 +94,7 @@ int uname_architecture(void); - # endif - # else - # define native_architecture() ARCHITECTURE_PPC_LE --# error "Missing LIB_ARCH_TUPLE for PPCLE" -+# define LIB_ARCH_TUPLE "powerpcle-linux-gnu" - # endif - #elif defined(__ia64__) - # define native_architecture() ARCHITECTURE_IA64 --- -2.30.0 - diff --git a/srcpkgs/elogind/patches/rlim-max.patch b/srcpkgs/elogind/patches/rlim-max.patch new file mode 100644 index 000000000000..a0b01d516375 --- /dev/null +++ b/srcpkgs/elogind/patches/rlim-max.patch @@ -0,0 +1,14 @@ +diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c +index afd74ac..3a731f4 100644 +--- a/src/basic/rlimit-util.c ++++ b/src/basic/rlimit-util.c +@@ -44,7 +44,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) { + fixed.rlim_max == highest.rlim_max) + return 0; + +- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max); ++ log_debug("Failed at setting rlimit %ju for resource RLIMIT_%s. Will attempt setting value %ju instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max); + + return RET_NERRNO(setrlimit(resource, &fixed)); + } + diff --git a/srcpkgs/elogind/patches/sigfillset.patch b/srcpkgs/elogind/patches/sigfillset.patch new file mode 100644 index 000000000000..787eeac9bc80 --- /dev/null +++ b/srcpkgs/elogind/patches/sigfillset.patch @@ -0,0 +1,12 @@ +diff --git a/src/basic/async.h b/src/basic/async.h +index cf80acf..d22e77d 100644 +--- a/src/basic/async.h ++++ b/src/basic/async.h +@@ -2,6 +2,7 @@ + #pragma once + + #include ++#include + + #include "macro.h" + diff --git a/srcpkgs/elogind/patches/statx.patch b/srcpkgs/elogind/patches/statx.patch new file mode 100644 index 000000000000..b568bbb66e98 --- /dev/null +++ b/srcpkgs/elogind/patches/statx.patch @@ -0,0 +1,30 @@ +Upstream: no, musl only +Source: https://raw.githubusercontent.com/chimera-linux/cports/81f0a3c25df2a841c2d99d752e60296062bf7543/main/elogind/patches/statx.patch + +diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c +index ab8744b..59ff466 100644 +--- a/src/basic/mountpoint-util.c ++++ b/src/basic/mountpoint-util.c +@@ -11,7 +11,7 @@ + //#include "filesystems.h" + #include "fs-util.h" + #include "missing_stat.h" +-//#include "missing_syscall.h" ++#include "missing_syscall.h" + //#include "mkdir.h" + #include "mountpoint-util.h" + #include "nulstr-util.h" +diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c +index d8e0693..f8324ed 100644 +--- a/src/basic/stat-util.c ++++ b/src/basic/stat-util.c +@@ -18,7 +18,7 @@ + #include "macro.h" + //#include "missing_fs.h" + #include "missing_magic.h" +-//#include "missing_syscall.h" ++#include "missing_syscall.h" + #include "nulstr-util.h" + //#include "parse-util.h" + #include "stat-util.h" + diff --git a/srcpkgs/elogind/patches/strerror_r.patch b/srcpkgs/elogind/patches/strerror_r.patch new file mode 100644 index 000000000000..a29ef7880d99 --- /dev/null +++ b/srcpkgs/elogind/patches/strerror_r.patch @@ -0,0 +1,90 @@ +fix strerror_r use instead of whatever this define is meant to be doing +-- +From 0542d27ebbb250c09bdcfcf9f2ea3d27426fe522 Mon Sep 17 00:00:00 2001 +From: Chen Qi +Date: Tue, 10 Jul 2018 15:40:17 +0800 +Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi + strerror_r + +XSI-compliant strerror_r and GNU-specifi strerror_r are different. + + int strerror_r(int errnum, char *buf, size_t buflen); + /* XSI-compliant */ + + char *strerror_r(int errnum, char *buf, size_t buflen); + /* GNU-specific */ + +We need to distinguish between them. Otherwise, we'll get an int value +assigned to (char *) variable, resulting in segment fault. + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi + +--- + src/libsystemd/sd-bus/bus-error.c | 5 +++++ + src/libsystemd/sd-journal/journal-send.c | 5 +++++ + 2 files changed, 10 insertions(+) + +diff --git a/src/basic/musl_missing.h b/src/basic/musl_missing.h +index 41c66c9..a2e1d7e 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 4d687cf..1459396 100644 +--- a/src/libelogind/sd-bus/bus-error.c ++++ b/src/libelogind/sd-bus/bus-error.c +@@ -409,7 +409,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 + x = strerror_r(error, m, k); ++#endif + if (errno == ERANGE || strlen(x) >= k - 1) { + free(m); + k *= 2; +@@ -594,8 +599,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 + return strerror_r(abs(error), buf, ERRNO_BUF_LEN); ++#endif + } + + 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 4010197..1d49868 100644 +--- a/src/libelogind/sd-journal/journal-send.c ++++ b/src/libelogind/sd-journal/journal-send.c +@@ -444,7 +444,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 + j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); ++#endif + if (errno == 0) { + char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1]; + + diff --git a/srcpkgs/elogind/patches/strerror_r_1.patch b/srcpkgs/elogind/patches/strerror_r_1.patch new file mode 100644 index 000000000000..c6cfd799353f --- /dev/null +++ b/srcpkgs/elogind/patches/strerror_r_1.patch @@ -0,0 +1,43 @@ +From f66b5c802ce0a3310f5580cfc1b02446f8087568 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 23 Jan 2023 23:39:46 -0800 +Subject: [PATCH] errno-util: Make STRERROR portable for musl + +Sadly, systemd has decided to use yet another GNU extention in a macro +lets make this such that we can use XSI compliant strerror_r() for +non-glibc hosts + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj +--- + src/basic/errno-util.h | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h +index 091f99c590..eb5c1f9961 100644 +--- a/src/basic/errno-util.h ++++ b/src/basic/errno-util.h +@@ -14,8 +14,16 @@ + * https://stackoverflow.com/questions/34880638/compound-literal-lifetime-and-if-blocks + * + * Note that we use the GNU variant of strerror_r() here. */ +-#define STRERROR(errnum) strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN) +- ++static inline const char * STRERROR(int errnum); ++ ++static inline const char * STRERROR(int errnum) { ++#ifdef __GLIBC__ ++ return strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN); ++#else ++ static __thread char buf[ERRNO_BUF_LEN]; ++ return strerror_r(abs(errnum), buf, ERRNO_BUF_LEN) ? "unknown error" : buf; ++#endif ++} + /* A helper to print an error message or message for functions that return 0 on EOF. + * Note that we can't use ({ … }) to define a temporary variable, so errnum is + * evaluated twice. */ +-- +2.39.1 + + diff --git a/srcpkgs/elogind/template b/srcpkgs/elogind/template index 73dc786ad70a..97d129f1f323 100644 --- a/srcpkgs/elogind/template +++ b/srcpkgs/elogind/template @@ -1,24 +1,24 @@ # Template file for 'elogind' pkgname=elogind -version=246.10 -revision=3 +version=252.9 +revision=1 build_style=meson -configure_args="-Dcgroup-controller=elogind -Dhalt-path=/usr/bin/halt - -Drootlibexecdir=/usr/libexec/elogind -Dreboot-path=/usr/bin/reboot - -Dkexec-path=/usr/bin/kexec -Ddefault-hierarchy=legacy - -Ddefault-kill-user-processes=false -Dman=true - -Dpolkit=true" -hostmakedepends="docbook-xsl gettext-devel gperf intltool libxslt m4 - pkg-config shadow glib-devel" -makedepends="acl-devel eudev-libudev-devel gettext-devel libglib-devel libcap-devel - libseccomp-devel pam-devel" +configure_args="-Dcgroup-controller=elogind -Ddefault-hierarchy=legacy + -Ddefault-kill-user-processes=false -Dhalt-path=/usr/bin/halt + -Dkexec-path=/usr/bin/kexec -Dman=true -Dpolkit=true + -Dreboot-path=/usr/bin/reboot -Drootlibdir=/usr/lib + -Drootlibexecdir=/usr/libexec/elogind" +hostmakedepends="docbook-xsl gettext-devel glib-devel gperf intltool libxslt + m4 pkg-config python3-Jinja2 shadow" +makedepends="acl-devel eudev-libudev-devel gettext-devel libcap-devel + libglib-devel libseccomp-devel pam-devel" depends="dbus" short_desc="Standalone logind fork" maintainer="Enno Boland " license="GPL-2.0-or-later, LGPL-2.0-or-later" homepage="https://github.com/elogind/elogind" distfiles="https://github.com/${pkgname}/${pkgname}/archive/v${version}.tar.gz" -checksum=c490dc158c8f5bca8d00ecfcc7ad5af24d1c7b9e59990a0b3b1323996221a922 +checksum=7af8caa8225a406e77fb99c9f33dba5e1f0a94f0e1277c9d91dcfc016f116d85 conf_files="/etc/elogind/*.conf" # tests fail differently due to containerization and kernel features make_check=ci-skip