commit:     2a4d6044d7e638cae9f0979d5f3afa273358b816
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  6 18:41:00 2026 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Fri Feb  6 18:41:47 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2a4d6044

sys-apps/dbus-broker: fix test with newer kernels

Closes: https://bugs.gentoo.org/969686
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 sys-apps/dbus-broker/dbus-broker-37.ebuild         |  6 ++-
 .../files/dbus-broker-37-test-sockopt.patch        | 51 ++++++++++++++++++++++
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/sys-apps/dbus-broker/dbus-broker-37.ebuild 
b/sys-apps/dbus-broker/dbus-broker-37.ebuild
index 005abffa0179..7d025e90e5d5 100644
--- a/sys-apps/dbus-broker/dbus-broker-37.ebuild
+++ b/sys-apps/dbus-broker/dbus-broker-37.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2017-2025 Gentoo Authors
+# Copyright 2017-2026 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -41,6 +41,10 @@ BDEPEND="
        virtual/pkgconfig
 "
 
+PATCHES=(
+       "${FILESDIR}"/dbus-broker-37-test-sockopt.patch
+)
+
 if [[ ${PV} == 9999 ]]; then
 src_unpack() {
        git-r3_src_unpack

diff --git a/sys-apps/dbus-broker/files/dbus-broker-37-test-sockopt.patch 
b/sys-apps/dbus-broker/files/dbus-broker-37-test-sockopt.patch
new file mode 100644
index 000000000000..190eed82ff72
--- /dev/null
+++ b/sys-apps/dbus-broker/files/dbus-broker-37-test-sockopt.patch
@@ -0,0 +1,51 @@
+https://bugs.gentoo.org/969686
+https://github.com/bus1/dbus-broker/pull/409
+
+From ef7c0fd47f035553cb7ba606ce43613c62f1fc66 Mon Sep 17 00:00:00 2001
+From: David Rheinsberg <[email protected]>
+Date: Thu, 4 Sep 2025 10:23:36 +0200
+Subject: [PATCH] test/sockopt: loosen verification of stale pidfds
+
+Newer kernels now properly return stale pidfds from AF_UNIX sockets,
+rather than refusing the operation. Ensure that our tests adopt to this
+and properly verify staleness.
+
+Signed-off-by: David Rheinsberg <[email protected]>
+---
+ src/util/test-sockopt.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/src/util/test-sockopt.c b/src/util/test-sockopt.c
+index 04148afa..eaa8fba6 100644
+--- a/src/util/test-sockopt.c
++++ b/src/util/test-sockopt.c
+@@ -81,17 +81,25 @@ static void test_peerpidfd_client(
+ 
+         r = sockopt_get_peerpidfd(fd, &pidfd);
+         if (r != SOCKOPT_E_UNSUPPORTED) {
+-                if (stale) {
+-                        c_assert(r == SOCKOPT_E_REAPED);
++                if (r == SOCKOPT_E_REAPED) {
++                        /*
++                         * Old kernels refused to return stale pidfds. Hence,
++                         * in that case verify that we expected a stale pidfd.
++                         */
++                        c_assert(stale);
+                 } else {
+                         c_assert(!r);
+                         c_assert(pidfd >= 0);
+ 
+                         r = proc_resolve_pidfd(pidfd, &pid_socket);
+                         c_assert(!r);
+-                        c_assert(pid_socket > 0);
+ 
+-                        c_assert(pid_socket == pid_server);
++                        if (stale) {
++                                c_assert(pid_socket == -1);
++                        } else {
++                                c_assert(pid_socket > 0);
++                                c_assert(pid_socket == pid_server);
++                        }
+                 }
+         }
+ }

Reply via email to