diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-03-16 01:20:09 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-03-16 01:20:09 +0900 |
| commit | 273d97af8502059193ccb6a188422f9d22eaf106 (patch) | |
| tree | d26ae85bbdd32d15c8581627923c607a261370e3 /internal | |
| parent | 891316d9240fc5cf451ad88f92e82f82b1751ab8 (diff) | |
ldd: lib paths resolve function
This is what always happens right after a ldd call, so implement it here.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/sandbox/container_test.go | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/internal/sandbox/container_test.go b/internal/sandbox/container_test.go index 566de75c..1a629d99 100644 --- a/internal/sandbox/container_test.go +++ b/internal/sandbox/container_test.go @@ -7,8 +7,6 @@ import ( "log" "os" "os/exec" - "path" - "slices" "syscall" "testing" "time" @@ -94,23 +92,10 @@ func TestContainer(t *testing.T) { }, os.Args[0]); err != nil { log.Fatalf("ldd: %v", err) } else { - libPathsM := make(map[string]struct{}, len(entries)) - for _, ent := range entries { - if path.IsAbs(ent.Path) { - libPathsM[path.Dir(ent.Path)] = struct{}{} - } - if path.IsAbs(ent.Name) { - libPathsM[path.Dir(ent.Name)] = struct{}{} - } - } - libPaths = make([]string, 0, len(libPathsM)) - for name := range libPathsM { - libPaths = append(libPaths, name) - } - slices.Sort(libPaths) - for _, name := range libPaths { - container.Bind(name, name, 0) - } + libPaths = ldd.Path(entries) + } + for _, name := range libPaths { + container.Bind(name, name, 0) } mnt := make([]*check.Mntent, 0, 3+len(libPaths)) |
