Repository navigation
fix(tools): keep BinDiff from panicking on a full Git Bash pipe - #75
Merged
Merged
Conversation
Zig 0.17.1 file writers panic when an asynchronous pipe fills up, which took about 200 changed ELF sections. The report is now built in memory and written once, through WriteFile on Windows. Exit codes are unchanged. Verified: 3,000 changed sections through a Git Bash pipe give the same bytes as the output to a file; the new overlapped pipe test fails with exit 3 before the fix; tools/bindiff/check.py 15/15 CLI tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
p3p-bindiffpanicked when its output filled a Git Bash pipe: those pipes are asynchronous, and the Zig 0.17.1 file writers treatPENDINGasunreachable. The report is now built in memory and written once, throughWriteFileon Windows. Exit codes are unchanged, also with a closed stdout (exit 2).Verification
--elfwith 3,000 changed sections through| cat: 1,083,473 bytes, identical to the output to a file, exit 1. Before the fix it stopped at about 73 KB with exit 3, in text and--jsonmode.test_output_to_a_full_asynchronous_pipe(Windows, overlapped pipe): fails with exit 3 on the build before the fix, passes now. Python's own pipes are synchronous and never showed this.python tools/bindiff/check.py: format check, Debug and safe unit tests, 15/15 CLI tests. Thex86_64-linux-muslcross-build passes; CI runs it on Linux.Normal use was rarely affected: at most about 6.3 KB in byte mode, 919 bytes for
--elf --jsonof the real EBOOT against itself.Closes #74