From 4f827cfaf523d2c8b19eee8f38d931a3b2f06fa2 Mon Sep 17 00:00:00 2001 From: Sam James Date: Mon, 6 Apr 2026 00:53:11 +0100 Subject: [PATCH] dev-libs/libgudev: fix tests w/ >=systemd-259 Closes: https://bugs.gentoo.org/971296 Signed-off-by: Sam James --- .../files/238-systemd-259-tests.patch | 50 +++++++++++++++++++ dev-libs/libgudev/libgudev-238-r2.ebuild | 3 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 dev-libs/libgudev/files/238-systemd-259-tests.patch diff --git a/dev-libs/libgudev/files/238-systemd-259-tests.patch b/dev-libs/libgudev/files/238-systemd-259-tests.patch new file mode 100644 index 0000000000000..fed94017ea72d --- /dev/null +++ b/dev-libs/libgudev/files/238-systemd-259-tests.patch @@ -0,0 +1,50 @@ +https://bugs.gentoo.org/971296 +https://gitlab.gnome.org/GNOME/libgudev/-/issues/10 +https://gitlab.gnome.org/GNOME/libgudev/-/merge_requests/34 + +From 67b7db1d91c8da1f9bed56596e4c23f39b00bc0d Mon Sep 17 00:00:00 2001 +From: r-vdp +Date: Fri, 13 Mar 2026 11:46:34 +0100 +Subject: [PATCH] tests: clear environment before + udev_device_new_from_environment + +udev_device_new_from_environment() processes all of environ, adding +unrecognised entries as device properties. Since systemd 259.4 (PR #41001) +property validation rejects keys/values with control characters. + +Build and CI environments routinely contain env vars whose values +include newlines, causing the device creation to fail with EINVAL. + +Fix by calling clearenv() before setting the udev-specific variables, +so only the intended properties are present when the device is created. +--- + tests/test-gudevdevice.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/tests/test-gudevdevice.c b/tests/test-gudevdevice.c +index 9639058..d64c1ce 100644 +--- a/tests/test-gudevdevice.c ++++ b/tests/test-gudevdevice.c +@@ -6,6 +6,7 @@ + */ + + #include ++#include + #include + #include + #include +@@ -24,6 +25,12 @@ test_tags () + struct udev_device *udev_device = NULL; + g_autoptr(GUdevDevice) dev = NULL; + ++ /* Clear the environment so that udev_device_new_from_environment() only ++ * sees the properties we set below. Since systemd 259.4 property ++ * validation rejects keys/values with control characters, and build and CI ++ * environments routinely contain env vars whose values include newlines. */ ++ clearenv (); ++ + /* Push device information into environment. */ + g_setenv ("DEVPATH", "/devices/dev1", TRUE); + g_setenv ("SUBSYSTEM", "subsystem", TRUE); +-- +2.53.0 diff --git a/dev-libs/libgudev/libgudev-238-r2.ebuild b/dev-libs/libgudev/libgudev-238-r2.ebuild index 6a7245bc737bf..1118b7adb3cf4 100644 --- a/dev-libs/libgudev/libgudev-238-r2.ebuild +++ b/dev-libs/libgudev/libgudev-238-r2.ebuild @@ -1,4 +1,4 @@ -# Copyright 2015-2025 Gentoo Authors +# Copyright 2015-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 @@ -30,6 +30,7 @@ BDEPEND=" PATCHES=( "${FILESDIR}"/${PV}-clang18-export-dynamic.patch #926350 + "${FILESDIR}"/238-systemd-259-tests.patch #971296 ) multilib_src_configure() {