code wiki / (root) / nx_sevenz_gate.nx

nx_sevenz_gate.nx

buildroot/runtime/nx_sevenz_gate.nx

22518 B363 linesdepth 8pulls 13 transitivereach 0 importersview sourcekind gate/prooftopic sevenz
docsdependenciesstructsconstsfunctions

about

nx_sevenz_gate.nx -- THE 7z READER GATE (/compare/modding MD29 sz_walk, 2026-09-06). The subjects are two REAL archives mirrored from the py7zr test corpus (knowledge/fetched/cmp_modding_py7zr_test_1.7z, an LZMA2 archive with an encoded header, and cmp_modding_py7zr_copy.7z, a Copy-coder archive), never a fixture this lane authored -- a reader tested only on archives its author wrote proves it can read its author. The oracle is the archive's OWN per-member CRC-32 digests written by the outside encoder: every data member must decode to exactly its declared size AND hash to the digest the archive carries, through the decoder nx_lzma_lib and the container reader nx_sevenz_lib, with nothing third-party in the path. Named refusals are planted at runtime (a cut container, a forged start-header CRC, a forged header CRC, a corrupted packed byte) and each must be refused by NAME, never read clean. The rung's done-rule fixture (an OBJ, its MTL, four PNG maps, a VMD) is written by the estate's own Copy-coder writer and must walk to the SAME typed partition MD1's zip fixture reaches, through the lib and through the bundle walker that dispatches on the magic. The command is a second witness through the ladder live -> staged -> build fossil, and an extract is re-hashed by the SAME crc32 the archive used. usage: nx_sevenz_gate (no args) license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_gatekit_lib.nx nx_bundle_ingest_lib.nx nx_sevenz_lib.nx nx_sevenz_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_gatekit_lib.nxnx_bundle_ingest_lib.nxnx_sevenz_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_mkdir sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close gv_need gv_puts sys_write ↻ gv_verdict gv_note_bare_rate gv_bare_rate gv_at gv_obj_has_n gv_at ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap ↻

structs

none

consts

20const ZG_DIR: *u8 = "/tmp/nx_sevenz_gate"
21const ZG_T1: *u8 = "knowledge/fetched/cmp_modding_py7zr_test_1.7z"
22const ZG_CP: *u8 = "knowledge/fetched/cmp_modding_py7zr_copy.7z"
23const ZG_CUT: *u8 = "/tmp/nx_sevenz_gate/cut.7z"
24const ZG_BADSTART: *u8 = "/tmp/nx_sevenz_gate/badstart.7z"
25const ZG_BADHDR: *u8 = "/tmp/nx_sevenz_gate/badhdr.7z"
26const ZG_BADPACK: *u8 = "/tmp/nx_sevenz_gate/badpack.7z"
27const ZG_TYPED: *u8 = "/tmp/nx_sevenz_gate/typed.7z"
28const ZG_M0: *u8 = "/tmp/nx_sevenz_gate/member0.bin"
29const ZG_ELF_LIVE: *u8 = "./nx_sevenz.elf"
30const ZG_ELF_STAGE: *u8 = "./nx_sevenz.sov.elf.new"
31const ZG_ELF_BUILD: *u8 = "buildroot/_build/nx_sevenz.sov.elf"
32const ZG_BI_LIVE: *u8 = "./nx_bundle_ingest.elf"
33const ZG_BI_STAGE: *u8 = "./nx_bundle_ingest.sov.elf.new"
34const ZG_BI_BUILD: *u8 = "buildroot/_build/nx_bundle_ingest.sov.elf"
35const ZG_DIR_MODE: i64 = 493
36const ZG_FILE_MODE: i64 = 420
37const ZG_CAP: i64 = 65536
38const ZG_NAMES_HEADROOM: i64 = 4096
39const ZG_ST_N: i64 = 8
40const ZG_START_CRC_OFF: i64 = 8
41const ZG_FIRST_PACK_OFF: i64 = 32
42const ZG_TYPED_N: i64 = 7
43const ZG_PNG_LEN: i64 = 40
44const ZG_VMD_LEN: i64 = 30
45const ZG_VMD_MAGIC_LEN: i64 = 25
46const ZG_TYPED_CAP: i64 = 4096

functions

48func zg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: main
49func zg_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
called by 1: zg_ladder calls 2: sys_openat_rdsys_close
50func zg_write_file(path: *u8, b: *u8, n: i64) -> i64
59func zg_twin(b: *u8, n: i64, flip_off: i64, path: *u8) -> *u8
called by 1: main calls 2: sys_mmapzg_write_file
68func zg_walk(b: *u8, n: i64, out_tbl: *i64, out_names: *i64, st: *i64) -> i64
called by 1: main calls 3: sz_countsys_mmapsz_walk
82func zg_census(tbl: *i64, m: i64, res: *i64) -> i64
called by 1: main calls 1: bi_rec
105func zg_ladder(live: *u8, stage: *u8, build: *u8) -> *u8
called by 1: main calls 1: zg_exists
112func main(argc: i64, argv: *i64) -> i64