Repository navigation
tools: a path outside the console's code page no longer crashes a tool's output - #1428
Conversation
…l's output On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with UnicodeEncodeError as soon as a tool printed it. ItsNotRexed#1406 fixed make_game.py; every CLI tool in tools/ now starts its __main__ block the same way (stdout errors="replace"). tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes (analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e07f046 to
f698bf2
Compare
|
Tested f698bf2 on Windows 11 Pro 26300 with system code page 1253 (Greek), Python 3.14.0: the fix works, but the PR's own test fails on one tool. The PR's diff applied cleanly to
|
|
Tested on Linux (WSL2 Ubuntu), Python 3.12, CPU only: fails after merging current |
…after this branched) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Flyander
left a comment
There was a problem hiding this comment.
Blocking CI issue remains at the current head: the regression test scans the merged tools tree, where tools/bink_names.py is present from #1403 but is not updated by this PR. The same missing reconfigure call is reproduced in the two review comments above. Please include that entrypoint so the new test passes against current main.
Flyander
left a comment
There was a problem hiding this comment.
The latest commit adds the missing bink_names.py stdout guard, matching the reported regression-test failure. The concrete issue from my earlier review is resolved; the latest CI checks are still running.
… unencodable stdout - d3d12_compute_test and d3d12_draw_test (built when glslangValidator is found) had no add_test, which test_ctest_registration catches; registered like their neighbours (exit 77 is a skip). - awc_names.py (#1421) and bink_names.py (#1403) are new tools without #1428's stdout errors='replace' guard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested a9d8f29 (0 behind main) on Windows 11 Home 10.0.26300, with ANSI code page 1252, the case this PR is for. Python 3.14.7, pytest 9.2.0.
Overlap: #1426 fixes the same AI-assisted (Claude Code). No game files. |
…AT_SUPPORT check, four tools' stdout - run_gpu_tests.py: #1541's wave64 pixel fixtures (runtime/test/shaders/w64_graphics.py FIXTURES, tiers A-C) are checked by that runner; run_gpu_tests picked up their .asm and failed 14 of them with "no checker defined". It now leaves w64_graphics.FIXTURES to that runner. - d3d12_d24_support_test (#1493): expected DEPTH_STENCIL in FORMAT_SUPPORT for R24G8_TYPELESS. Measured here, the host D3D12 (RTX 4060 Ti and WARP) reports 0x001010b0 for R24G8_TYPELESS and 0x003110b0 (DEPTH_STENCIL) only for D24_UNORM_S8_UINT, which #1511's per-format rules follow; the check now expects the bit for the typed format only. - fma_mix_probe, text_tables, wave64_halves, xdxr_bvh: new tools without #1428's stdout errors='replace' guard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ools (ItsNotRexed#1428) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d stdout - #1617 and #1620 both handle the float MODE fields gfx1170+ can't set. #1620's runner returns the reason for that kernel and runs the rest; #1617's test still expected Unavailable for the whole run. The test now checks the per-kernel reason. - fspx_unpack.py, user_sgpr_census.py, world_lights_paths.py: new tools without #1428's stdout errors='replace'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…four tools follow the repo rules - int_hw_probe: VOP3 clamp on the carry-out add/sub ops (#1831) and v_cvt_rpi/flr's exact floor(x+0.5) and NaN sign saturation (#1856) now translate as gfx1035 measured, so KNOWN_DIVERGENCES is empty. The known-divergence test reports a synthetic entry. shader_validation.md says so, and design.md loses the stale duplicate v_cvt_flr/rpi row a "both" merge left that still called them open. - docs/README.md: one Other languages line (fr, pt-BR, zh-CN, pl-PL, tr, ru, ja); docs/i18n/README.md: one row each for pt-BR and zh-CN (the newer). - anim_rigs, d16_format_probe, pe_shader_containers: text writes name newline="\n" (#1615); pe_shader_containers guards stdout (#1428). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claimed in the coordination issue as: #1380 (comment) (@abilliontokens's finding 7078242007)
What and why
On Windows a redirected stdout (
tool.py > log.txt, or a pipe) is encoded with the console's ANSI code page, andpython -IignoresPYTHONUTF8andPYTHONIOENCODING. A caller path with a character outside that code page therefore ends the run withUnicodeEncodeErroras soon as a tool prints it. That covers a Cyrillic, Greek or CJK user name, or a Polish one under a code page that lacks it. stderr already escapes (backslashreplace); stdout is strict. #1406 fixedmake_game.py.Every CLI tool in
tools/(all 84 with a__main__block) now starts that block the same way #1406 does:It's four lines per tool and nothing else changes. Importing a tool as a module, as the tests do, isn't affected.
Tested
Windows 11 Pro 26300, Python 3.13. Each input sits under a folder named with a private-use character that no ANSI code page maps.
Measured on
main: given a zeroed input there,analyze_4240_full.pyandmeshlet_page.pydie withUnicodeEncodeErroron every run.audio_wav.py,hashdict.pyandshader_profile.pydie the same way once their--outalready exists.New
tests/test_tool_stdout_encoding.py:__main__block setserrors="replace";It passes here; with
main'stools/it fails 4 ways (the static check plus the two crashes, one listing 84 tools).All 152 stdlib-only test files under
tests/(CI's selection): OK.pytest tests/test_tex_export.py tests/test_tex_headers.py tests/test_vertex_types.py: 181 passed.compileall: OK.Not touched:
tools/navmesh_index.py's case-sensitive containment check, the second half of the finding, which belongs to @bobcatchris's BUILD-350.AI-assisted (Claude Code).
Checklist
docs/design.md, with how it was confirmed. (n/a)🤖 Generated with Claude Code