Skip to content

tarcmd tests: the passthrough filter is written once, before any child - #69

Merged
closer-claudio merged 1 commit into
mainfrom
claudio/20261110-etxtbsy
Nov 10, 2026
Merged

closer-claudio merged 1 commit into
mainfrom
claudio/20261110-etxtbsy

Conversation

@closer-claudio

Copy link
Copy Markdown
Contributor

🎯 Why

TestCompressProgram failed once on #67 verify lane, ubuntu-24.04-arm (https://github.com/forkcloser/compress/actions/runs/42761685321/job/129648982339): tar: …/passthrough: Cannot run: text file busy, then passed on a rerun. The test wrote its filter script and ran it through -I while parallel tests in the package fork zstdmt, unzstd and the system tar. fork copies every descriptor, close-on-exec ones included, and a child between fork and exec holds the script's write descriptor until its exec; the kernel refuses to exec a file open for writing (golang/go#22315, os/exec does not retry).

🛠️ What

internal/tarcmd/run_test.go: a TestMain writes the passthrough script once, before m.Run, into a temporary directory removed afterwards; TestCompressProgram runs that script and writes nothing executable. The window is closed by construction: the script's write descriptor is closed before the test process forks for the first time, so no child can inherit it.

🧪 How

V: the tarcmd package and just test (273 tests) green, just lint green. V: Go's test wrapper passes m.Run's result to os.Exit when TestMain returns (testing.go), so no explicit exit. U: the race is not reproducible on demand; the argument is structural.

TestCompressProgram wrote its filter script and ran it through tar's
-I in the same test, in parallel with tests that run zstdmt, unzstd
and the system tar. A child forked by one of those between the
script's open and close inherits the write descriptor until its exec,
and running the script in that window fails with "text file busy"
(golang/go#22315); the verify lane met it on ubuntu-24.04-arm and
passed on a rerun. TestMain now writes the script before any test
runs, with no child alive, and the test runs it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: closer-claudio <claudio@farcloser.world>
@closer-claudio closer-claudio added the internal Changes nothing for a consumer: tooling, CI, maintainers' docs; left out of the notes label Nov 10, 2026
@closer-claudio

Copy link
Copy Markdown
Contributor Author

Reviewed at f78b159

@closer-claudio
closer-claudio merged commit f1afd4b into main Nov 10, 2026
14 checks passed
@closer-claudio
closer-claudio deleted the claudio/20261110-etxtbsy branch November 10, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Changes nothing for a consumer: tooling, CI, maintainers' docs; left out of the notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants