Repository navigation
test(go): hard-link the test binary instead of copying it before exec - #225
Merged
Merged
Conversation
deferred_tests_decline_unlinked_current_executable copied its own binary
and exec'd the copy. A test thread that forks while the copy's write
descriptor is open hands that descriptor to its child, and exec of a
file open for writing fails with ETXTBSY ("Text file busy"), as CI saw
on #224. A hard link is never opened for writing; it lives beside the
binary because hard links cannot cross filesystems.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
calvin-archastro
force-pushed
the
fix/go-unlink-test-hard-link
branch
from
October 30, 2026 00:28
c46c59d to
e06718a
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review on ArchCode
Problem and author intent
plugins::go::tests::deferred_tests_decline_unlinked_current_executable(Linux only) failed on #224 atgo.rs:820withOs { code: 26, kind: ExecutableFileBusy, message: "Text file busy" }.The race:
fs::copys its own binary, then execs the copy.cargo testruns tests on many threads, and several of them spawn processes.What changed
fs::copy→fs::hard_link. A hard link is never opened for writing.Scope / Risk / User impact
Test-only. Low risk. No user impact.
Testing
cargo test --lib -- plugins::ran 150 times each before and after in arust:1.88container, with 0 failures in both. The ETXTBSY window is narrow. This fix follows from the CI error and the known fork-during-copy behaviour, not from a local repro.Test (ubuntu-latest)).Follow-ups
If ETXTBSY ever appears again in this test, the cause is something else.
🤖 Generated with Claude Code