Skip to content

fix(history): ownership check crashes with UnicodeDecodeError on non-cp1252 git output - #216

Merged
Wolfvin merged 1 commit into
mainfrom
fix/ownership-encoding-crash
Jul 12, 2026
Merged

fix(history): ownership check crashes with UnicodeDecodeError on non-cp1252 git output#216
Wolfvin merged 1 commit into
mainfrom
fix/ownership-encoding-crash

Conversation

@Wolfvin

@Wolfvin Wolfvin commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Found while auditing history --check ownership against KDS backend — crashed with 'NoneType' object has no attribute 'split' and a background UnicodeDecodeError in the subprocess reader thread.

Root cause: 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 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 ownership now returns correctly (Wolfvin: 1681 commits, Raymond Fo: 776, etc.) instead of crashing.

@Wolfvin
Wolfvin merged commit 8a081c3 into main Jul 12, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Wolfvin
Wolfvin deleted the fix/ownership-encoding-crash branch July 12, 2026 02:39
…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.
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant