Repository navigation
Conversation
…t destinations - Reconfigure sys.stdout with errors="replace" so unencodable Unicode paths on redirected Windows consoles (strict cp1252) do not raise UnicodeEncodeError - Default argv=None in main() and fall back to sys.argv - Validate extract destination against existing files or input path aliases - Validate pack source directory and output destination against directories and inside-source file clobbering; ensure parent directories are created - Register tools/saves.py in tests/test_resource_hygiene.py - Add RedirectedConsoleEncodingTest and CliPathValidationTest in tests/test_saves.py
|
Independent CPU/Windows verification, at head
The redirected-console case was exercised on Windows here; no GPU or runtime claim. |
|
Tested on Linux (WSL2 Ubuntu), Python 3.12, CPU only: pass. Tests with |
Flyander
left a comment
There was a problem hiding this comment.
Found an input-clobber case in extract: the guard catches out == p, but it does not catch a source file located inside the output directory. For example, if a valid JSAV file is <out>/index.json, extract(p, out) reads it and then opens that same path with "w" while writing the generated index, replacing the source. Please reject an input beneath out (or check all generated output paths against p) before writing. The existing same-path test does not cover this directory-contained case.
|
Independent CPU verification, at head
Overlap to settle before merge#1426 (BUILD-401) adds the same
Since stderr's documented fallback in CPython is |
Item: new BUILD item (@abilliontokens's finding 7078242007), claimed in #1380 (claim)
What and why
Addresses @abilliontokens's finding on issue #1380 (finding):
tools/saves.py):tools/saves.pyprints output paths and save titles to stdout (extract:print(f'{len(es)} blocks -> {out}'),pack:print(f'wrote {out}...'),import: prints slot title).python -I, stdout is strictly encoded with the console ANSI code page (cp1252), causingUnicodeEncodeErrorwhen paths or save titles contain non-Latin characters (CJK, Cyrillic, Greek, or private-use characters).main()now reconfiguressys.stdoutwitherrors="replace", matching make_game: a redirected console must not kill --find on an un-encodable path #1406 inmake_game.py.main(argv=None) -> int):argvoptional defaulting toNone, falling back tosys.argv.extract):ValueErrorinstead of lettingos.makedirscrash withFileExistsError.sys.exiton unsupported container format withValueErrorsomain()reportsERROR: ...uniformly with exit code 2.pack):srcis an existing directory.same_path/is_inside_dir).tools/saves.pyintests/test_resource_hygiene.py.tests/test_saves.py):RedirectedConsoleEncodingTest: executes child process underPYTHONIOENCODING=cp1252with unencodable characterin the path, asserting clean exit 0.CliPathValidationTest: verifies extract refuses existing file destinations and input aliases, pack refuses missing/file sources, existing directories, and in-source destination paths, pack creates parent directories, andmain()handles defaultargv=None.Testing
Tested on Windows 11 with Python 3.14 (AMD Radeon RX 7800 XT):
python -I tests/test_saves.py: 38/38 pass (8 new tests).python -m compileall -q make_game.py tools tests: pass.python -I make_game.py --help: pass.python -I tests/test_resource_hygiene.py: pass (2/2).python -I tests/test_docs_links.py: pass (5/5).node --test tests/test_viewer_streaming.cjs: pass (35/35).No game data, carved files, or keys included.
AI-assisted.