Skip to content

tools: mutant-run's --copy lock takes flock(2) through python3, so the Mac's self-test runs - #193

Merged
midagedev merged 1 commit into
mainfrom
perf-mrflock
Oct 14, 2026
Merged

midagedev merged 1 commit into
mainfrom
perf-mrflock

Conversation

@midagedev

Copy link
Copy Markdown
Owner

tools/mutant-run.sh --self-test fails on the Mac: flock: command not found (macOS has no flock(1)). #189 added the --copy DIR lock and its self-test holder with flock.

Fix

  • The lock on fd 9 is python3 -c 'import fcntl; fcntl.flock(9, LOCK_EX | LOCK_NB)'. flock(2) locks the shell's open file description, so the lock stays held after python3 exits and is freed when the shell closes fd 9.
  • The self-test's holder takes the same lock through python3.

Evidence

  • FAIL-first: on main 541c740 with a flock stub that exits 127 first in PATH, the self-test ends mutant-run: self-test 6 failed (flock: command not found, --copy left a file the tree does not have).
  • With this change: the same PATH gives mutant-run: self-test ok; the normal Linux PATH gives mutant-run: self-test ok.
  • The lock still excludes: with fd 9 locked by the shell, a second process's non-blocking flock is refused; after exec 9>&- it succeeds.

Prepared by the bloomery assistant on behalf of @midagedev.

🤖 Generated with Claude Code

…e Mac's self-test runs

macOS has no flock(1); the copy-dir lock and its self-test holder called it,
so the self-test failed six cases there. python3's fcntl.flock on fd 9 locks
the shell's open file description, which keeps the lock after python3 exits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo label Oct 14, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: CLEAN: Both changed lock sites no longer require flock(1); no must-fix finding remains.

Non-blocking

⚠ Native macOS evidence: tools/mutant-run.sh:634.
The PR reports Linux runs for a macOS fix. Add a native macOS bash tools/mutant-run.sh --self-test run with full output to confirm the copy and contention paths there. The existing contention assertion does not test lock lifetime after a successful acquisition.

Checked

Duplicates: 0 new functions, types or constants; the holder and acquisition have different roles.
Complexity: no Rust functions changed.
Silent failure: the acquisition error reaches a named refusal and exits 2 before refreshing the copy.
Tests: shell syntax and read-only Linux lock probes pass. The lock survives Python exit and releases when the shell closes fd 9. Removing acquisition at line 634 would fail the contention assertion at line 373.
Gates: no thresholds moved or cases removed; the contention assertion remains.
Escape catalog: no C1–C4 patterns match the added lines.

Notes

Dryer and crapper did not run because no Rust file changed.
The full self-test was not run; its assertions were read and the changed acquisition was exercised with read-only descriptors.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@midagedev
midagedev merged commit 65990b0 into main Oct 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant