fix(history): ownership check crashes with UnicodeDecodeError on non-cp1252 git output - #216
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…cp1252 git output All 5 subprocess.run() calls in ownership_engine.py used text=True without an explicit encoding, so Python decoded git blame/log/shortlog output with the platform's default locale codec — cp1252 on Windows — which crashes with UnicodeDecodeError on any byte outside cp1252's range (accented author names, non-ASCII commit text). Found via real-codebase validation: 'history --check ownership' crashed with "'NoneType' object has no attribute 'split'" against Coretax-Auto-Downloader's KDS backend, whose git history contains commits from authors with non-ASCII names/text. Fix: add encoding='utf-8', errors='replace' to all 5 calls — same pattern issue #179's _force_utf8_stdio() fix used for stdout/stderr, applied here to subprocess output instead.
|
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.



Found while auditing
history --check ownershipagainst KDS backend — crashed with'NoneType' object has no attribute 'split'and a backgroundUnicodeDecodeErrorin the subprocess reader thread.Root cause: all 5
subprocess.run()calls inownership_engine.pyusedtext=Truewithout an explicitencoding, so Python decoded git blame/log/shortlog output with the platform's default locale codec —cp1252on Windows — which crashes on any byte outside cp1252's range (accented author names, non-ASCII commit text present in this repo's real git history).Fix: add
encoding='utf-8', errors='replace'to all 5 calls — same class of fix as issue #179's_force_utf8_stdio(), applied to subprocess output instead of stdout/stderr.Verified:
history --check ownershipnow returns correctly (Wolfvin: 1681 commits, Raymond Fo: 776, etc.) instead of crashing.