Repository navigation
test_navmesh_nodes: skip the read-only --out case when the 0o444 file stays writable - #8880
Open
DefectiveMuffins wants to merge 1 commit into
Open
DefectiveMuffins wants to merge 1 commit into
DefectiveMuffins wants to merge 1 commit into
Conversation
… stays writable test_cli_refuses_an_unwritable_out_before_the_archives_are_read failed as uid 0 (root containers, `unshare -r`): CAP_DAC_OVERRIDE makes the 0o444 --out writable, so the tool rightly went on to read the archives. Probe an append-open on the file first, as tests/test_bvh_match.py does, and skip only when that succeeds. A normal user, or root on a read-only mount, still runs the unchanged refusal and its assertions. NAVMESHNODES-ROOT-TEST
|
Tested on Apple M1 Max, macOS 27.2.1 arm64, Python 3.12.16: |
Grimkeh
reviewed
Nov 23, 2026
Grimkeh
left a comment
There was a problem hiding this comment.
Independent Linux CPU review (321d50c7)
What changed: test_navmesh_nodes skips the read-only --out case when a 0o444 file stays writable (e.g. root).
Checked: test_navmesh_nodes 16 OK (1 skipped). Complements #8884's preserve change.
Looks correct; no game files.
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.
Claim: #8504 (comment) (
NAVMESHNODES-ROOT-TEST/ coordinatorTEST-1905)What and why
tests/test_navmesh_nodes.py'sArchiveTest.test_cli_refuses_an_unwritable_out_before_the_archives_are_readcreates a0o444--outfile (read-only.json) and asserts thattools/navmesh_nodes.pyrefuses it (out_problem(path)checkingnot os.access(path, os.W_OK)) before reading either input archive. When the test suite runs asuid 0on a writable filesystem (for example in a root container or underunshare -r),CAP_DAC_OVERRIDEmakes a0o444file writable:os.access(out, os.W_OK)returnsTrue,out_problem(out)returnsNone, andnavmesh_nodes.pyrightly proceeds to readjunk.rpfand fails withERROR: .../junk.rpf: not an RPF7/8/9 archive, failing the test'sself.assertIn("read-only", cp.stderr).Following the existing capability-probe pattern in
tests/test_bvh_match.py(test_readonly_json_is_one_error_line),test_cli_refuses_an_unwritable_out_before_the_archives_are_readnow probeswith open(out, "ab"):afteros.chmod(out, 0o444)and callsself.skipTest("the 0o444 --out is still writable (running as root, or a file system ignoring modes)")only when opening the0o444file for writing succeeds. Unprivileged runs—anduid 0runs whereoutis on a read-only mount (EROFS)—raiseOSErroron the probe and execute the unchanged refusal and assertions ("read-only","not an RPF9 archive", and unchanged file contents).No open PR dependencies (
Depends on:none). Separate from closed #6108 (post-scan write error handling) and #6608 (merged).Tested
AI-assisted. Tested on Fedora Linux (kernel 7.3.3-300.fc45.x86_64), CPython 3.12.16 (
-I -B); CPU-only standard-library unit test (no GPU used, no game files):321d50c7b42efb77c713072d21f346e80a9035be(parent867d922f09b86583859796a174df89555fb32da8):euid != 0):python -I -B tests/test_navmesh_nodes.py -v— 17/17 pass (Ran 17 tests in 0.490s — OK, 0 skipped).euid == 0):unshare -r python -I -B tests/test_navmesh_nodes.py -v— 16 pass, 1 skipped (Ran 17 tests in 0.445s — OK (skipped=1)).read-only.jsonon a read-only bind mount (unshare -rmremountingread-only.jsonwithmount -o remount,ro,bind):test_cli_refuses_an_unwritable_out_before_the_archives_are_readruns and passes (Ran 1 test in 0.036s — OK,skipped=0).tests/test_navmesh_nodes.pyat867d922f09b86583859796a174df89555fb32da8underunshare -r): failstest_cli_refuses_an_unwritable_out_before_the_archives_are_readwithAssertionError: 'read-only' not found in 'ERROR: .../junk.rpf: not an RPF7/8/9 archive\n'.python -I -B -m compileall -q tests/test_navmesh_nodes.py: exit 0.python -I -B scripts/check_no_game_data.py tests/test_navmesh_nodes.py: exit 0.git diff --check HEAD~1..HEAD: exit 0.