diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-05-25 19:50:06 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-05-25 19:50:06 +0900 |
| commit | dde2516304ac6b0edc1dfc6650f37d32fa62642c (patch) | |
| tree | 62051967304af040f25801e9a30b95569aabe62d /dbus/proxy.go | |
| parent | f30a439bcd6aa97fac0f99cdd94381ae025aa64d (diff) | |
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 <cat@gensokyo.uk>
Diffstat (limited to 'dbus/proxy.go')
| -rw-r--r-- | dbus/proxy.go | 16 |
1 files changed, 16 insertions, 0 deletions
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)...) } |
