From dde2516304ac6b0edc1dfc6650f37d32fa62642c Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sun, 25 May 2025 19:50:06 +0900 Subject: dbus: handle bizarre dbus proxy behaviour There is a strange behaviour in xdg-dbus-proxy where if any interface string when stripped of a single ".*" suffix does not contain a '.' byte anywhere, the program will exit with code 1 without any output. This checks for such conditions to make the failure less confusing. Signed-off-by: Ophestra --- dbus/proxy.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'dbus/proxy.go') diff --git a/dbus/proxy.go b/dbus/proxy.go index a18bf753..c44971eb 100644 --- a/dbus/proxy.go +++ b/dbus/proxy.go @@ -2,6 +2,7 @@ package dbus import ( "context" + "fmt" "io" "os/exec" "sync" @@ -14,6 +15,15 @@ import ( // Overriding ProxyName will only affect Proxy instance created after the change. var ProxyName = "xdg-dbus-proxy" +type BadInterfaceError struct { + Interface string + Segment string +} + +func (e *BadInterfaceError) Error() string { + return fmt.Sprintf("bad interface string %q in %s bus configuration", e.Interface, e.Segment) +} + // Proxy holds the state of a xdg-dbus-proxy process, and should never be copied. type Proxy struct { helper helper.Helper @@ -66,9 +76,15 @@ func Finalise(sessionBus, systemBus ProxyPair, session, system *Config) (final * var args []string if session != nil { + if err = session.checkInterfaces("session"); err != nil { + return + } args = append(args, session.Args(sessionBus)...) } if system != nil { + if err = system.checkInterfaces("system"); err != nil { + return + } args = append(args, system.Args(systemBus)...) } -- cgit v1.3.1