nx_libcheck.nx
buildroot/runtime/nx_libcheck.nx
about
nx_libcheck.nx -- DUPLICATE-LIBRARY DIVERGENCE DETECTOR. The instrument that would have caught BOTH
defects that cost this session real time (seq1423 dual-copy, seq1437 silent revert).
THE INSIGHT: when a library exists in two directories, THE COPIES ARE EACH OTHER'S CONTROL. Nothing else
needs to be known about them. If they are byte-identical the tree is coherent; the moment they differ,
EITHER someone edited one copy and forgot the other (seq207 dual-copy -- organs under runtime/ resolve one,
organs under _hdl_build/ resolve the other, so half the ecosystem silently keeps old behaviour) OR one copy
was reverted underneath you (seq48/132/140 -- a sibling ships an old lib into buildroot and the NEXT BUILD
STILL SUCCEEDS, shipping the old behaviour with RC=0 and no diagnostic anywhere).
Both are invisible at build time. Both are one hash comparison away from being obvious.
FAIL-CLOSED AND DATA-DRIVEN: divergence is a FAILURE by default. Some same-named files are legitimately
DIFFERENT ORGANS -- _hdl_build/nx_fs.nx is a coreutils multitool while the live nx_fs is nx_fsops -- so the
exceptions live in a CONF (rule 11), never in this code. An unlisted divergence exits 3. A conf that cannot
be read simply means zero exceptions, which fails LOUDER rather than quieter.
Run it BEFORE a build that touches a shared lib. Cheap enough to run every time.
EXIT: 0 all duplicates identical (or expected) - 2 usage - 3 UNEXPECTED divergence - 4 no duplicates found
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 22 | const LC_MAXF: i64 = 24576 // runtime/ alone holds 10748 .nx and _hdl_build/ 6726 (measured), so 4096 |
| 26 | const LC_ARENA: i64 = 2097152 |
| 27 | const LC_DBUF: i64 = 262144 |
| 28 | const LC_FBUF: i64 = 2097152 |
| 29 | const LC_PATH: i64 = 1024 |
| 30 | const LC_MSG: i64 = 8192 |
| 31 | const LC_CONF: i64 = 65536 |
| 32 | const LC_FNV_BASIS: i64 = 1469598103934665603 |
| 33 | const LC_FNV_PRIME: i64 = 1099511628211 |
| 34 | const LC_STDOUT: i64 = 1 |
| 35 | const LC_NL: i64 = 10 |
| 36 | const LC_HASH_C: i64 = 35 |
| 37 | const LC_DOT: i64 = 46 |
| 38 | const LC_SLASH: i64 = 47 |
| 39 | const LC_EXIT_USAGE: i64 = 2 |
| 40 | const LC_EXIT_DIVERGED: i64 = 3 |
| 41 | const LC_EXIT_NODUPES: i64 = 4 |
| 42 | const LC_EXIT_INDEXCAP: i64 = 5 |
functions
| 44 | func lc_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: lc_is_nx |
| 45 | func lc_cat(d: *u8, off: i64, s: *u8) -> i64 called by 1: main |
| 50 | func lc_num(d: *u8, off: i64, v: i64) -> i64 |
| 70 | func lc_canon(path: *u8) -> i64 |
| 146 | func lc_streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 153 | func lc_is_nx(s: *u8) -> i64 |
| 162 | func lc_hash(path: *u8, szout: *i64) -> i64 |
| 184 | func main(argc: i64, argv: *i64) -> i64 |