tooling: report damaged inputs in dxil_retarget without a traceback #658
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/664"
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 R0Y00/Xbox2Windows. Originally posted by louisdibiasi on 2026-11-22T18:29:44Z.
Change
tools/dxil_retarget.pyraisesValueErrorfor an input that is not a DXBC container or LLVM bitcode, for a truncated container and for a truncated bitcode stream, andOSErrorfor an unreadable input. None was caught, so each ended in a traceback. The existing invalid-arguments check only requires a non-zero exit status, which a traceback also satisfies. This reportsOSErrorandValueErrorasdxil_retarget.py: <message>with exit status 1.Independent problem, no linked issue.
Verification
Commit under test:
88ebeb3on719552e, Windows 11, Python 3.12.10.python -B tools/dxil_retarget.py <input> out.bin, base vs this branch:ValueError: Input must be a DXBC container or raw LLVM bitcodetraceback, exit 1dxil_retarget.py: Input must be a DXBC container or raw LLVM bitcode, exit 1DXBC0123456789abcdefValueError: Expected a DXBC containertracebackdxil_retarget.py: Expected a DXBC containerBC\xc0\xde\x00\x00ValueError: Unexpected end of LLVM bitcode stream during alignmenttracebackFileNotFoundErrortracebackdxil_retarget.py: [Errno 2] No such file or directory: '<path>'New cases in
tests/dxil_retarget_check.py(check_pure_python_controls) run the CLI on the first three inputs and a missing path and require exit 1, noTraceback, and no output file.AssertionErrorat the first case (stderr shows the traceback).pure-python dxil_retarget controls: ok.Evidence and follow-up
Synthetic bytes only. The handler sits in the
__main__guard so it also covers the--pepath; valid inputs and the other error paths (for exampleCalledProcessErrorfrom a probe) are unchanged. TheValueErrormessages do not name the input file; only the missing-file message does.Checklist
AI-assisted: I used Claude to find the bug and draft the change. I ran the reproductions and tests above myself.