From 36f312b3ba45f1bec6341b4f66a1f2e89971bc51 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sat, 11 Oct 2025 20:15:53 +0900 Subject: [PATCH] internal/app/spcontainer: resolve path through dispatcher This prevents state from os tainting the test data. Signed-off-by: Ophestra --- internal/app/app_test.go | 2 ++ internal/app/spcontainer.go | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/app/app_test.go b/internal/app/app_test.go index 226b1b7..0142152 100644 --- a/internal/app/app_test.go +++ b/internal/app/app_test.go @@ -581,6 +581,8 @@ func (k *stubNixOS) lookupEnv(key string) (string, bool) { return "/run/user/1971", true case "XDG_CONFIG_HOME": return "/home/ophestra/xdg/config", true + case "DBUS_SYSTEM_BUS_ADDRESS": + return "", false default: panic(fmt.Sprintf("attempted to access unexpected environment variable %q", key)) } diff --git a/internal/app/spcontainer.go b/internal/app/spcontainer.go index 62c4f4f..247b798 100644 --- a/internal/app/spcontainer.go +++ b/internal/app/spcontainer.go @@ -139,7 +139,12 @@ func (s *spFilesystemOp) toSystem(state *outcomeStateSys) error { varRunNscd, } - _, systemBusAddr := dbus.Address() + // dbus.Address does not go through syscallDispatcher + systemBusAddr := dbus.FallbackSystemBusAddress + if addr, ok := state.k.lookupEnv(dbus.SystemBusAddress); ok { + systemBusAddr = addr + } + if entries, err := dbus.Parse([]byte(systemBusAddr)); err != nil { return &hst.AppError{Step: "parse dbus address", Err: err} } else {