diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-09 19:08:54 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-09 19:08:54 +0900 |
| commit | 02271583fb791987a9406c9ba282c75ff7a0e395 (patch) | |
| tree | 00b35900e1ff7bf4fa5f24e7322a9beb222098b9 /system | |
| parent | ef54b2cd086ee8a3186c9646711d70e226815973 (diff) | |
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 <cat@gensokyo.uk>
Diffstat (limited to 'system')
| -rw-r--r-- | system/dbus/dbus_test.go | 2 | ||||
| -rw-r--r-- | system/dbus/proc.go | 19 |
2 files changed, 11 insertions, 10 deletions
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) } |
