Files
sfile/tools/apply_testloop_overrides5.py
Muse 4d357b8a49 Test loop rounds 1-7: 440 PASS, 82 PARTIAL, 2 FAIL (duplicates), 325 NO SAMPLE
- 7 override batches (247 overrides): bogus magics removed (##, xmlns:,
  504b0506, fishead, ENDFREQUENCIES), wrong exts fixed (.JVX->.JXL,
  .files->.MKA/.ICE, .LGA->.LHA, .OTS->.OTT, .OSB->.OSC), ~130 formats
  verified as text from samples+pages
- Container layouts added: PDF, TIFF LE/BE, OLE/CFB (ZIP/RIFF/ftyp/Ogg/
  gzip/RAR/IFF already there)
- Engine: JSON '[' guard (INI [PHP] no longer misread as JSON); SH 2-byte
  #! magic removed (stole .run samples)
- Generator: override may set its own derivation; nocode-task overrides
  get complete default entries (fixed KeyError crash)
- Harness: skips backup-suffixed samples, junk-sample detection,
  task-key normalisation, iterates all 849 tasks
- Sample surgery: real files extracted from distribution ZIPs/gz/tar/LHA;
  11+ provably wrong samples deleted
- 2 remaining FAILs are unresolvable duplicates: 312 INI (=311), 520 PBO
  (=519) — same format, same extension, indistinguishable by content
2026-11-25 02:58:27 +00:00

45 lines
2.2 KiB
Python

#!/usr/bin/env python3
"""apply_testloop_overrides5.py — fifth batch (Nov 25, 2026 test loop).
FODG's bogus 'xmlns:' magic, LHA (ext .LGA was wrong; the code's crc/count
fields are wrong — filename is variable-length), PK3=ZIP.
Run: python3 tools/apply_testloop_overrides5.py (then: make table)
"""
import json
import os
HERE = os.path.dirname(os.path.abspath(__file__))
ov = json.load(open(os.path.join(HERE, "overrides.json")))
# FODG is flat ODF (XML); the code-derived 'xmlns:' magic is a namespace
# prefix, not a file signature.
ov["235"] = {"magic": "3c3f786d6c", "derivation": "text",
"notes": "FODG is flat ODF (XML); the xmlns: magic is a namespace prefix, not a signature"}
# LHA: the page and the code are about LHA (also .LZH); .LGA is a bad
# extraction. Method string '-lh5-' etc. at offset 2. The struct-derived
# crc/count fields are wrong: filename is variable-length, so crc follows
# it; count belongs to the handler struct, not the entry.
ov["355"] = {
"ext": ".LHA", "magic": "2d6c68", "magic_off": 2,
"fields": [
{"name": "header_len", "offset": 0, "size": 1, "kind": "u8"},
{"name": "checksum", "offset": 1, "size": 1, "kind": "u8"},
{"name": "method", "offset": 2, "size": 6, "kind": "ascii"},
{"name": "comp_size", "offset": 8, "size": 4, "kind": "u32"},
{"name": "uncomp_size", "offset": 12, "size": 4, "kind": "u32"},
{"name": "timestamp_raw", "offset": 16, "size": 4, "kind": "u32"},
{"name": "attr", "offset": 20, "size": 1, "kind": "u8"},
{"name": "level", "offset": 21, "size": 1, "kind": "u8"}],
"derivation": "override",
"notes": "LHA archive; .LGA was a bad extraction; crc follows the variable-length filename so it has no fixed offset"}
with open(os.path.join(HERE, "overrides.json"), "w") as f:
json.dump(ov, f, indent=1, sort_keys=True)
p = os.path.join(HERE, "gen_formats.py")
s = open(p).read()
s = s.replace('".MSCZ": "504b0304", ".OTS": "504b0304", ".PPSX": "504b0304", ".KRA": "504b0304",',
'".MSCZ": "504b0304", ".OTS": "504b0304", ".PPSX": "504b0304", ".KRA": "504b0304", ".PK3": "504b0304",')
open(p, "w").write(s)
print("overrides: 235, 355; table: .PK3 -> ZIP")