diff options
| author | evilclanker9000 <45567075+evilclanker9000@users.noreply.github.com> | 2026-11-23 15:24:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-23 08:24:41 -0600 |
| commit | 4a1fa33b47ff34cba3cd09fd19dc69b718ba6b16 (patch) | |
| tree | 0162a2eec1eb702d3a6f7fd8ed129b56a99d0d8d /tools/script_qtable.py | |
| parent | 27a80ca819e1c794410634cc8f8a646ab6642520 (diff) | |
script_qtable: a missing or unreadable input is one ERROR line and exit 2 (EGEN-SCRIPTQTABLE-MISSING-INPUT, DeepSeek2) (#6232)
Squash-merged after diff review of PR #6232 - script_qtable: a missing or unreadable input is one ERROR line and exit 2 (EGEN-SCRIPTQTABLE-MISSING-INPUT, DeepSeek2)
Diffstat (limited to 'tools/script_qtable.py')
| -rw-r--r-- | tools/script_qtable.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tools/script_qtable.py b/tools/script_qtable.py index 39af06720..afa037245 100644 --- a/tools/script_qtable.py +++ b/tools/script_qtable.py | |||
| @@ -591,9 +591,18 @@ def main(argv=None) -> int: | |||
| 591 | check_report_path(a.json, a.target, rows=rows) | 591 | check_report_path(a.json, a.target, rows=rows) |
| 592 | blob, meta = load_qtable_payload(a.target) | 592 | blob, meta = load_qtable_payload(a.target) |
| 593 | report = parse_qtable(blob, root_hash=root_h, type_hash=type_h) | 593 | report = parse_qtable(blob, root_hash=root_h, type_hash=type_h) |
| 594 | except (OSError, ValueError, KeyError, TypeError, struct.error, RuntimeError) as e: | 594 | except UsageError as e: |
| 595 | print("error:", e, file=sys.stderr) | 595 | print(f"ERROR: {e}", file=sys.stderr) |
| 596 | return 2 if isinstance(e, UsageError) else 1 | 596 | return 2 |
| 597 | except FileNotFoundError: | ||
| 598 | print(f"ERROR: {a.target}: does not exist", file=sys.stderr) | ||
| 599 | return 2 | ||
| 600 | except OSError as e: | ||
| 601 | print(f"ERROR: cannot read {a.target}: {e.strerror or e}", file=sys.stderr) | ||
| 602 | return 2 | ||
| 603 | except (ValueError, KeyError, TypeError, struct.error, RuntimeError) as e: | ||
| 604 | print(f"ERROR: {e}", file=sys.stderr) | ||
| 605 | return 1 | ||
| 597 | 606 | ||
| 598 | out = {"location": meta, **report} | 607 | out = {"location": meta, **report} |
| 599 | _print_summary(out) | 608 | _print_summary(out) |
| @@ -604,8 +613,8 @@ def main(argv=None) -> int: | |||
| 604 | with open(a.json, "w", encoding="utf-8", newline="\n") as f: | 613 | with open(a.json, "w", encoding="utf-8", newline="\n") as f: |
| 605 | json.dump(out, f, indent=1) | 614 | json.dump(out, f, indent=1) |
| 606 | except OSError as e: | 615 | except OSError as e: |
| 607 | print(f"error: cannot write {a.json}: {e.strerror or e}", file=sys.stderr) | 616 | print(f"ERROR: cannot write {a.json}: {e.strerror or e}", file=sys.stderr) |
| 608 | return 1 | 617 | return 2 |
| 609 | print("wrote", a.json) | 618 | print("wrote", a.json) |
| 610 | 619 | ||
| 611 | return 0 if report["valid"] else 1 | 620 | return 0 if report["valid"] else 1 |