fix(test): don't write through seeded uname symlink in prereq-parity tests (unblock CI)#1143
Merged
Merged
Conversation
…ity tests full_bin_dir seeds PATH tools as symlinks to the real binaries; _fake_uname then overwrote `uname` via write_text(), which FOLLOWS the symlink and rewrites the host's /usr/bin/uname → PermissionError on the CI runner (TestNonLinuxHost::test_darwin_is_rejected / test_linux_is_accepted), or silent mutation of the real binary when the suite runs as root. _write_exe now unlinks first so it replaces the symlink with a regular file. Unblocks CI on main (regression from #1098/#1139 merged green off a box-local run where /usr/bin/uname was writable). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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.
tests/installer/test_bootstrap_prereq_parity.py::TestNonLinuxHostfails on the GitHub runner withPermissionError: [Errno 13] ... /bin/uname— currently red on main (regression from #1098/#1139, which merged green off a box-local run).Cause:
full_bin_dirseeds PATH tools as symlinks to the real binaries;_fake_uname→_write_exeusedwrite_text(), which follows the symlink and rewrites the host's/usr/bin/uname. Denied on a locked-down runner; on a root box it silently mutates the real binary.Fix:
_write_exeunlinks the path first, replacing the seeded symlink with a regular file.Verified:
pytest tests/installer/test_bootstrap_prereq_parity.py→ 15 passed; ruff clean. Test-only.🤖 Generated with Claude Code