diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-11-14 21:53:10 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-11-14 21:53:10 +0900 |
| commit | 46fa1044195ed1e98f3b27cadbad4f8153f7977d (patch) | |
| tree | 40dc470e55c98adb69db2eb5e34280e750eebce3 /ldd/exec_test.go | |
| parent | 45953b3d9c250658767aa6bb673422f8d954b950 (diff) | |
ldd: require absolute pathname
The sandbox which ldd(1) runs in does not inherit parent work directory, so relative pathnames will not work correctly. While it is trivial to support such a use case, the use of relative pathnames is highly error-prone and generally frowned against in this project. The Exec function remains available under the same signature until v0.4.0 where it will be removed.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'ldd/exec_test.go')
| -rw-r--r-- | ldd/exec_test.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ldd/exec_test.go b/ldd/exec_test.go index a6d3a7e5..8c35a905 100644 --- a/ldd/exec_test.go +++ b/ldd/exec_test.go @@ -7,6 +7,7 @@ import ( "testing" "hakurei.app/container" + "hakurei.app/container/check" "hakurei.app/ldd" "hakurei.app/message" ) @@ -17,7 +18,7 @@ func TestExec(t *testing.T) { t.Run("failure", func(t *testing.T) { t.Parallel() - _, err := ldd.Exec(t.Context(), nil, "/proc/nonexistent") + _, err := ldd.Resolve(t.Context(), nil, check.MustAbs("/proc/nonexistent")) var exitError *exec.ExitError if !errors.As(err, &exitError) { @@ -33,7 +34,7 @@ func TestExec(t *testing.T) { t.Run("success", func(t *testing.T) { msg := message.New(nil) msg.GetLogger().SetPrefix("check: ") - if entries, err := ldd.Exec(t.Context(), nil, container.MustExecutable(msg)); err != nil { + if entries, err := ldd.Resolve(t.Context(), nil, check.MustAbs(container.MustExecutable(msg))); err != nil { t.Fatalf("Exec: error = %v", err) } else if testing.Verbose() { // result cannot be measured here as build information is not known |
