From 02271583fb791987a9406c9ba282c75ff7a0e395 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sat, 9 Aug 2025 19:08:54 +0900 Subject: container: remove PATH lookup behaviour This is way higher level than the container package and does not even work unless every path is mounted in the exact same location. This behaviour causes nothing but confusion and problems, Signed-off-by: Ophestra --- system/dbus/dbus_test.go | 2 +- system/dbus/proc.go | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'system') diff --git a/system/dbus/dbus_test.go b/system/dbus/dbus_test.go index 213bb376..bf3d3e7f 100644 --- a/system/dbus/dbus_test.go +++ b/system/dbus/dbus_test.go @@ -153,7 +153,7 @@ func testProxyFinaliseStartWaitCloseString(t *testing.T, useSandbox bool) { t.Run("string", func(t *testing.T) { wantSubstr := fmt.Sprintf("%s --args=3 --fd=4", os.Args[0]) if useSandbox { - wantSubstr = fmt.Sprintf(`argv: ["%s" "--args=3" "--fd=4"], filter: true, rules: 0, flags: 0x1, presets: 0xf`, os.Args[0]) + wantSubstr = `argv: ["xdg-dbus-proxy" "--args=3" "--fd=4"], filter: true, rules: 0, flags: 0x1, presets: 0xf` } if got := p.String(); !strings.Contains(got, wantSubstr) { t.Errorf("String: %q, want %q", diff --git a/system/dbus/proc.go b/system/dbus/proc.go index dfa42e28..ee298096 100644 --- a/system/dbus/proc.go +++ b/system/dbus/proc.go @@ -6,7 +6,6 @@ import ( "os" "os/exec" "path" - "path/filepath" "slices" "strconv" "syscall" @@ -43,24 +42,26 @@ func (p *Proxy) Start() error { cmd.Env = make([]string, 0) }, nil) } else { - toolPath := p.name - if filepath.Base(p.name) == p.name { - if s, err := exec.LookPath(p.name); err != nil { + var toolPath *container.Absolute + if a, err := container.NewAbsolute(p.name); err != nil { + if p.name, err = exec.LookPath(p.name); err != nil { + return err + } else if toolPath, err = container.NewAbsolute(p.name); err != nil { return err - } else { - toolPath = s } + } else { + toolPath = a } var libPaths []string - if entries, err := ldd.Exec(ctx, toolPath); err != nil { + if entries, err := ldd.Exec(ctx, toolPath.String()); err != nil { return err } else { libPaths = ldd.Path(entries) } p.helper = helper.New( - ctx, toolPath, + ctx, toolPath, "xdg-dbus-proxy", p.final, true, argF, func(z *container.Container) { z.SeccompFlags |= seccomp.AllowMultiarch @@ -111,7 +112,7 @@ func (p *Proxy) Start() error { } // xdg-dbus-proxy bin path - binPath := path.Dir(toolPath) + binPath := path.Dir(toolPath.String()) z.Bind(binPath, binPath, 0) }, nil) } -- cgit v1.3.1