From 038fd6ceacfe9b9421319ff764574f6f94a8e71a Mon Sep 17 00:00:00 2001 From: "Aaron D. Lee" Date: Sun, 4 Jan 2026 20:42:24 -0500 Subject: [PATCH] Fix decode debug logging to use stderr for systemd journal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Debug prints need file=sys.stderr to appear in journalctl output. Encode route was fixed but decode was still using plain print(). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- frontends/web/app.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/frontends/web/app.py b/frontends/web/app.py index a11a423..4d23b45 100644 --- a/frontends/web/app.py +++ b/frontends/web/app.py @@ -888,11 +888,12 @@ def encode_page(): # DEBUG: Log file hashes to verify bytes match between encode/decode import hashlib + import sys ref_hash = hashlib.md5(ref_data).hexdigest()[:8] carrier_hash = hashlib.md5(carrier_data).hexdigest()[:8] - print(f"[ENCODE DEBUG] ref: {len(ref_data)} bytes, md5: {ref_hash}") - print(f"[ENCODE DEBUG] carrier: {len(carrier_data)} bytes, md5: {carrier_hash}") - print(f"[ENCODE DEBUG] passphrase: '{passphrase}', pin: '{pin}'") + print(f"[ENCODE DEBUG] ref: {len(ref_data)} bytes, md5: {ref_hash}", file=sys.stderr) + print(f"[ENCODE DEBUG] carrier: {len(carrier_data)} bytes, md5: {carrier_hash}", file=sys.stderr) + print(f"[ENCODE DEBUG] passphrase: '{passphrase}', pin: '{pin}'", file=sys.stderr) # Handle RSA key - can come from .pem file or QR code image rsa_key_data = None @@ -1189,9 +1190,9 @@ def decode_page(): import hashlib ref_hash = hashlib.md5(ref_data).hexdigest()[:8] stego_hash = hashlib.md5(stego_data).hexdigest()[:8] - print(f"[DECODE DEBUG] ref: {len(ref_data)} bytes, md5: {ref_hash}") - print(f"[DECODE DEBUG] stego: {len(stego_data)} bytes, md5: {stego_hash}") - print(f"[DECODE DEBUG] passphrase: '{passphrase}', pin: '{pin}'") + print(f"[DECODE DEBUG] ref: {len(ref_data)} bytes, md5: {ref_hash}", file=sys.stderr) + print(f"[DECODE DEBUG] stego: {len(stego_data)} bytes, md5: {stego_hash}", file=sys.stderr) + print(f"[DECODE DEBUG] passphrase: '{passphrase}', pin: '{pin}'", file=sys.stderr) # Handle RSA key - can come from .pem file or QR code image rsa_key_data = None