From f68c8389daf615e36da32b34c0edc1d6ef917136 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 14 Dec 2025 13:55:26 +0000 Subject: [PATCH] Force English locale for GPG verify to fix localized output parsing Root cause: GPG outputs verification messages in the user's locale (e.g., German "Gute Signatur von" instead of "Good signature from"), causing the parsing logic to fail and display "Unknown signer". Solution: Force LC_ALL=C and LANG=C environment variables when calling 'gpg --verify' to ensure consistent English output across all locales. This ensures the code can reliably parse "Good signature from" regardless of the user's system language settings. --- trace/crypto.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/trace/crypto.py b/trace/crypto.py index f1f089a..c342a94 100644 --- a/trace/crypto.py +++ b/trace/crypto.py @@ -43,12 +43,19 @@ class Crypto: return False, "Not a GPG signed message" try: + # Force English output for consistent parsing across locales + import os + env = os.environ.copy() + env['LC_ALL'] = 'C' + env['LANG'] = 'C' + proc = subprocess.Popen( ['gpg', '--verify'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - text=True + text=True, + env=env ) stdout, stderr = proc.communicate(input=signed_content, timeout=10)