fix: installer crashes with AttributeError when WeasyPrint warns to stdout - #40
Open
satriachandrayw wants to merge 1 commit into
Open
fix: installer crashes with AttributeError when WeasyPrint warns to stdout#40satriachandrayw wants to merge 1 commit into
satriachandrayw wants to merge 1 commit into
Conversation
WeasyPrint emits warning text to stdout before its JSON output when
system libraries (pango/cairo/gobject) are missing. json.loads() fails
on the mixed output, causing parse_json_stdout to return None.
This cascades into:
- verification=None in the bootstrap result
- print_bootstrap_diagnostics calling .get() on None (AttributeError)
- bootstrap reporting ok=False even when ready=True
Changes:
- parse_json_stdout: extract JSON by finding first '{' when json.loads fails
- print_bootstrap_diagnostics: guard against None verification with 'or {}'
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.
Problem
Installer fails at bootstrap with:
Root cause chain:
libgobject-2.0-0) emits warning text to stdout before JSONparse_json_stdoutcallsjson.loads()on mixed output →JSONDecodeError→ returnsNoneverification: Nonepropagates into bootstrap resultprint_bootstrap_diagnosticscallspayload.get("verification", {}).get("notes", [])— Python's.get(key, default)returnsNonewhen key exists but value isNone, not the default.get()onNone→AttributeErrorNote: bootstrap actually succeeds (
ready: truein verify output) but gets reported as failure.Changes
scripts/bootstrap_environment.py—parse_json_stdout:{whenjson.loads()fails on mixed stdoutinstall.sh—print_bootstrap_diagnostics:(payload.get("verification") or {}).get("notes", [])— guard againstNoneverificationVerification
Before fix:
verification=None,ok=False, crash in diagnosticsAfter fix:
verification=dict,ok=True, notes populated with WeasyPrint warning