Skip to content

RAL-189: test scripts written without "Text file busy" - #276

Merged
Castor-o7 merged 1 commit into
mainfrom
ral-189
Nov 14, 2026
Merged

Castor-o7 merged 1 commit into
mainfrom
ral-189

Conversation

@Castor-o7

Copy link
Copy Markdown
Owner

Hosted CI on PR #275 failed once in levi::tests::output_held_open_after_levi_exits_doesnt_outlast_the_deadline with "Text file busy (os error 26)" running its fake levi. Cause: the test wrote the script with std::fs::write and ran it, while another test thread forked; between its fork and exec the child held a copy of the write descriptor (close-on-exec narrows the window but can't shut it), and exec of a file open for writing is refused.

  • New src/script.rs: rally::script::write(path, text) writes through a child (sh -c 'cat > "$1" && chmod 755 "$1"', text on stdin), so the test process never holds the file open at all.
  • All 14 write-then-chmod-755 sites (src/levi.rs, tests/cli.rs, service.rs, web.rs, shims.rs) use it; none is left.
  • Tests: written and runnable with mode 755, replaced when written again, an error where it can't be written, and 200 write-and-run cycles beside four threads spawning true, never busy. A standalone reproduction on Murph: std::fs::write + chmod failed 6 and 7 of 300; through a child, 0 and 0.
  • The board-ages browser flake (tests/web.rs:1647) seen on the same PR is earnest-raccoon's own story.

🤖 Generated with Claude Code

A test that wrote a stand-in program with std::fs::write and ran it could
fail with ETXTBSY: another thread's fork, between fork and exec, held a copy
of the write descriptor (hosted CI, levi::tests::output_held_open_after_levi_
exits_doesnt_outlast_the_deadline on PR #275). rally::script::write writes the
script through a child (sh, cat, chmod 755), so the test process never holds
it open for writing; all 14 write-then-chmod sites use it, with a test that
writes and runs a script 200 times beside four forking threads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Castor-o7
Castor-o7 merged commit 430bc05 into main Nov 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant