From 7d2b6a2cdea37f9f9fb27d7750c8fd8bde1fcbc1 Mon Sep 17 00:00:00 2001 From: PapyElGringo Date: Fri, 2 Aug 2024 23:04:16 +0200 Subject: [PATCH 1/2] Work around a dbus-broker bug with path_namespace='/' match rules --- lib/src/dbus_remote_object_manager.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/dbus_remote_object_manager.dart b/lib/src/dbus_remote_object_manager.dart index fb3d658..05cbcaa 100644 --- a/lib/src/dbus_remote_object_manager.dart +++ b/lib/src/dbus_remote_object_manager.dart @@ -53,7 +53,10 @@ class DBusRemoteObjectManager extends DBusRemoteObject { {required String name, required DBusObjectPath path}) : super(client, name: name, path: path) { var rawSignals = - DBusSignalStream(client, sender: name, pathNamespace: path); + DBusSignalStream(client, + sender: name, + /// Workaround for https://github.com/bus1/dbus-broker/issues/309 + pathNamespace: path.value != '/' ? path : null); signals = rawSignals.map((signal) { if (signal.interface == 'org.freedesktop.DBus.ObjectManager' && signal.name == 'InterfacesAdded' && From 04eb805175dfb1e4a4f3d025c9b1134285bc1f61 Mon Sep 17 00:00:00 2001 From: PapyElGringo Date: Sat, 24 Aug 2024 14:27:57 +0200 Subject: [PATCH 2/2] add clearer documentation about the workaround --- lib/src/dbus_remote_object_manager.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/src/dbus_remote_object_manager.dart b/lib/src/dbus_remote_object_manager.dart index 05cbcaa..fe52ca4 100644 --- a/lib/src/dbus_remote_object_manager.dart +++ b/lib/src/dbus_remote_object_manager.dart @@ -52,11 +52,13 @@ class DBusRemoteObjectManager extends DBusRemoteObject { DBusRemoteObjectManager(DBusClient client, {required String name, required DBusObjectPath path}) : super(client, name: name, path: path) { + // Only add path_namespace if it's non-'/'. This removes a no-op key from + // the match rule, and also works around a D-Bus bug where + // path_namespace='/' matches nothing. + // https://github.com/bus1/dbus-broker/issues/309 + var pathNamespace = path.value != '/' ? path : null; var rawSignals = - DBusSignalStream(client, - sender: name, - /// Workaround for https://github.com/bus1/dbus-broker/issues/309 - pathNamespace: path.value != '/' ? path : null); + DBusSignalStream(client, sender: name, pathNamespace: pathNamespace); signals = rawSignals.map((signal) { if (signal.interface == 'org.freedesktop.DBus.ObjectManager' && signal.name == 'InterfacesAdded' &&