Repository navigation
Conversation
…="replace" (BUILD-1265) A text-mode subprocess call decodes with errors="strict". When a child prints bytes the code page can't decode (a localized Windows console message in the OEM code page, wsl.exe's UTF-16LE errors, a path in another encoding), the output is lost: on POSIX run() raises UnicodeDecodeError; on Windows capture_output reads through threads, the reader thread dies with a traceback and stdout comes back as None with no exception in the caller. make_game.py (dotnet --list-sdks, the two vk_subgroup_info probes, the rpf9-explorer pin, the runtime probe), scripts/run_gpu_tests.py, scripts/bench_wave64.py and runtime/test/shaders/ (build.py, check.py, w64_graphics.py) now pass errors="replace", as make_game's other calls already did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same change for the tools that run llvm-mc, spirv-as/spirv-val, vk_compute_test and other children in text mode: the fuzzers (crosslane, lds, valu, image, valu_int_diff), ps_oracle, the hw_oracle runner and DRM probe, ab_control_flow, cf_diff, spirv_gs_to_compute, bary_fallback_gs, fma_mix_probe, isa_coverage, mesh_compute_vs, probe_gfx1036_vcmp16, turing_atlas, bink_index and rdna2spirv's two tool calls; mc_command.run forwards the keyword to subprocess.run. tools/shader_disasm.py is left to ItsNotRexed#4395 (BUILD-1245), which fixes it with its own test. tests/test_bary_fallback_gs.py's stand-in subprocess.run functions take the new keyword. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…D-1265) test_subprocess_text_errors.py parses the tracked Python under tools/, scripts/, make_game.py and runtime/test/shaders/ with ast and fails on a run/check_output/Popen/call/check_call call that decodes text (text= or universal_newlines= not False, or encoding=) without errors=. A negative control checks that the checker flags exactly the calls missing it, and a third test shows what is at stake: a child printing 0x8a (an OEM code-page letter) comes back replaced with errors="replace", and is lost without it (UnicodeDecodeError on POSIX, stdout None on Windows). tools/shader_disasm.py is skipped until ItsNotRexed#4395 lands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 0d062f28 on Windows 11: tests/test_subprocess_text_errors.py -> 3 tests, OK; tests/test_bary_fallback_gs.py -> 27 tests, OK; git diff --check clean.
Every text-mode child process now names errors= explicitly (the guard test scans for it), so a child's non-UTF-8 output cannot crash a tool with a decode traceback. No blocking issue.
|
Independent Windows check of I exercised the actual changed |
|
Automated test:
Same machine and setup as my earlier manual reports. AI-assisted (Claude Code). |
BUILD-1265 (@AirKyzzZ's finding). Claim: #4257 (comment)
A text-mode
subprocesscall (text=True,universal_newlines=Trueorencoding=) decodes witherrors="strict". When a child prints bytes the code page can't decode, the output is lost. The bytes can be a localized Windows console message in the OEM code page (cmd.exe's"non \x8a riconosciuto"in Italian),wsl.exe's UTF-16LE errors, or a path in another encoding. The failure looks different per platform, and on Windows it's quiet:run()raisesUnicodeDecodeError, so the tool dies with a traceback instead of its own error.capture_outputreads through threads. The decode error kills the reader thread, which prints a traceback to stderr, andr.stdoutcomes back asNonewith no exception in the caller. The tool then treats it as "no output". Checked here with Python 3.15.2 on Windows 11.Commits
make_game.py,scripts/run_gpu_tests.py,scripts/bench_wave64.py,runtime/test/shaders/(build.py,check.py,w64_graphics.py): 16 calls geterrors="replace".make_game.py's own five did not have it:dotnet --list-sdks, the twovk_subgroup_infoprobes, the rpf9-explorer pin and the runtime probe.tools/: the other 46 calls get the same.ps_oracle,hw_oracle,ab_control_flow,cf_diff,spirv_gs_to_compute,bary_fallback_gs,fma_mix_probe,isa_coverage,mesh_compute_vs,probe_gfx1036_vcmp16,turing_atlas,bink_indexand two inrdna2spirv.mc_command.runforwards**kwargstosubprocess.run, so its 7 calls take the keyword as-is.tools/shader_disasm.pyis left to shader_disasm: decode llvm-mc's output with errors="replace" (BUILD-1245) #4395 (BUILD-1245), which fixes it with its own test.subprocess.runintests/test_bary_fallback_gs.pytakes the new keyword.tests/test_subprocess_text_errors.py, a stdlib guard. It parses the tracked Python undertools/,scripts/,make_game.pyandruntime/test/shaders/withast, and fails on arun/check_output/Popen/call/check_callcall that decodes text withouterrors=.0x8a: witherrors="replace"that byte comes back as U+FFFD; without it the output is lost (an exception, orNoneon Windows).shader_disasm.pyuntil shader_disasm: decode llvm-mc's output with errors="replace" (BUILD-1245) #4395 lands; that one line can go then.All 62 edits are the same insertion, made with
astright after the existing text-mode keyword, so nothing else changes.compileallis clean.The guard is scoped to code that runs on the user's machine.
tests/has about 450 more such calls, but they decode our own Python children's output; changing them would touch dozens of open PRs.Tested (Windows 11, Python 3.15.2)
pytest tests --ignore=tests/semantic -n 10: 6,450 passed. The 8 failures are the onesmainhas on this machine, each with an open fix:test_build_llvm_mc_batch(tests: start _build.cmd as .\_build.cmd in the two batch-writer tests #3380),test_meta_to_xml_paths(Write metadata conversion failure reports as UTF-8 #3344),test_check_no_game_data(tests: test_check_no_game_data cleans up its git repository on Windows #3897) andtest_u16_high_half(rdna2spirv: declare the format-size table's constants with the rest of them #4071).main: fails and lists all 62 calls.scripts/run_gpu_tests.py --filter textureon an RTX 3060 (NVIDIA 610.88): 6/6 passed with the edited runner and fixture build.No game files. AI-assisted (Claude Code).
🤖 Generated with Claude Code