diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-10-18 20:05:07 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-10-18 20:05:07 +0900 |
| commit | 9eb09ee7556cea7b9c138e4a3bfa1692f95347a5 (patch) | |
| tree | 137abda6d7e797e2bf0ffec7cdc8891bd63c8b8d /cmd | |
| parent | 4e993b48c8f5c1357c5d3d3315eb4b0ffac7c00b (diff) | |
cmd/hakurei/testsuite: handle dynamic linker race
This retries when seeing files opened by the dynamic linker. This will
eventually be replaced by a statically linked anchor program that never
opens any files on its own.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/hakurei/testsuite/sandbox/main.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd/hakurei/testsuite/sandbox/main.go b/cmd/hakurei/testsuite/sandbox/main.go index 2b2cbed2..681718a7 100644 --- a/cmd/hakurei/testsuite/sandbox/main.go +++ b/cmd/hakurei/testsuite/sandbox/main.go @@ -6,6 +6,7 @@ package main import ( "context" + "errors" "fmt" "log" "os" @@ -288,7 +289,8 @@ func main() { pid, done := mustStart(c, testsuite.NewSerial(), 0, &cred, os.Stdin, os.Stdout, os.Stderr) prefix := filepath.Join(fhs.Proc, strconv.Itoa(pid), "fd") - var fail bool + retry: // TODO(ophestra): use statically linked anchor program + fail := false if entries, err := os.ReadDir(prefix); err != nil { log.Fatal(err.Error()) } else { @@ -309,8 +311,14 @@ func main() { prefix, ent.Name(), )); err != nil { + if errors.Is(err, os.ErrNotExist) { + goto retry + } log.Fatal(err.Error()) } + if strings.HasPrefix(d, "/lib") { + goto retry + } log.Printf("extra fd %d -> %s", fd, d) } } |
