Files
restic-manager/internal
steve aa80a3418e
CI / Test (linux/amd64) (pull_request) Successful in 48s
CI / Lint (pull_request) Successful in 23s
CI / Build (linux/amd64) (pull_request) Successful in 17s
CI / Build (linux/arm64) (pull_request) Successful in 18s
CI / Build (windows/amd64) (pull_request) Failing after 15m8s
test: write-then-rename script-bin helpers (avoid ETXTBSY under -race)
CI run #48 failed with:

  --- FAIL: TestRunInitShipsStartedAndFinished
      RunInit: ... fork/exec /tmp/.../restic: text file busy

setupScript and setupScriptBin used os.WriteFile to write a shell
script directly at the final path, then exec'd it. Under -race +
many t.Parallel tests, a fork-from-another-goroutine could inherit
the still-open writable fd from one of those WriteFile calls; the
kernel returns ETXTBSY when the freshly-execed binary still has a
writable fd anywhere on the system.

Fix: write to "<path>.tmp", then os.Rename into place. The rename
is a pure dirent op; by the time the final path exists, no process
has a writable fd on its inode and exec is safe. -race + -count=5
on both runner packages now passes consistently.
2026-05-04 09:43:27 +01:00
..