make_game: reject case aliases inside the game directory (MAKE-GAME-CASE-INSIDE-GUARD) #1627
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1627"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by KoLolX3 on 2026-11-25T06:16:43Z.
Claimed in the coordination issue as: MAKE-GAME-CASE-INSIDE-GUARD (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7154581392)
What and why
On case-insensitive volumes such as APFS, different capitalization can make the output or work directory appear outside the game directory even when it is inside it. Compare destination ancestors by filesystem identity when the lexical check misses, including when the destination does not exist yet. Synthetic tests cover both options, nested future paths, and an unrelated sibling.
Tested
python -I tests/test_make_game_paths.py(6 tests, 2 Windows-only skips)python -I scripts/run_semantic_tests.py tests/semantic(487 files, 6,279 tests, 0 files failed)python -I tests/test_text_write_line_endings.pypython -m compileall -q make_game.py tools tests,python -I make_game.py --help,python -I scripts/check_no_game_data.py make_game.py tests/test_make_game_paths.py, andgit diff --checkGPUs tested: n/a
AI-assisted: yes (OpenAI Codex)
Checklist
mainand merges cleanly.docs/design.md, with how it was confirmed. (Not applicable.)Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-25T10:35:12Z.
Independent verification (Windows, Python 3.11.9
-I -W error):path_is_withinkeeps the commonpath fast path and only on miss walks ancestors viaos.path.samefile— catches case aliases on volumes where normcase doesn't fold (APFS) and non-existent destinations; termination at fs-root fixpoint verified, per-ancestor OSError ignored correctly. Probes inside/outside/self/sibling-prefix/relative/different-drive all correct.test_make_game_paths.py6 OK (new case-alias test passes; APFS path covered via mock); compileall + line-endings + check_no_game_data + diff-check clean. AI-assisted verification.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:08:31Z.
Native Windows 11 NTFS Verification (
2af23b9ac3)Verified
2af23b9ac334254819d59045d426789adc596d12merged cleanly ontoorigin/main(c7753ed98a56677f10e34078b37eab0540e190ec,git merge-tree --write-treerc=0) on native Windows 11 (26200) + NTFS:origin/mainc7753ed98a): Probedmake_game.path_is_withinagainst both a live Windows 11 NTFS directory junction (mklink /J game_junc game, checking a not-yet-created nested destinationgame_junc\new\nestedagainstgame) and case-preservingcommonpath+ NTFSos.path.samefile(GAME\new\nestedagainstgame):origin/mainreturnedFalsefor both.origin/main + 2af23b9ac3): Walking existing ancestors withos.path.samefilereturnedTruefor both the live NTFS junction and the case-alias destination, andpython -I tests/test_make_game_paths.pypassed6/6 OK.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T00:16:57Z.
Tested
2af23b9acmerged (no commit) withmain829530dbd: Python 3.12.4, Windows 11 10.0.26300, CPU only.check_no_game_data.pyis clean.tests/test_make_game_paths.py, 6 tests pass.test_case_alias_of_game_rejects_existing_and_future_destinationspasses withmake_game.pyback tomaintoo. The fix targets volumes whereos.path.normcasedoes not fold case (APFS). On Windowsnormcasealready folds it, somainrejects the alias already. The change looks harmless on Windows (an extrasamefilewalk).No blocker from my side.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T00:37:21Z.
Merged after TheGeogeo's red/green check (check) (Windows, Python tests, no GPU needed) and a local re-check here. Merged after local re-verification: this PR merged onto
main070799580without conflict, and its test file(s) (tests/test_make_game_paths.py) pass there. Earlier today the same tests failed onmainwithout the PR (red/green) and a bundle with other open PRs showed no new failures.check_no_game_data.pyis clean. Windows 11, Python 3.14; no GPU needed for these tests.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.