nx_licdetect_lib.nx
buildroot/runtime/nx_licdetect_lib.nx
about
nx_licdetect_lib.nx -- WHICH LICENCE IS THIS TEXT? Read from the bytes, never from a declaration.
THE MEASUREMENT THAT JUSTIFIES A TEXT DETECTOR AT ALL. Across 124,278 licence chains surveyed in the
field, 96.5% of datasets and 95.8% of models LACK the required licence text, and only 2.3% / 3.2%
satisfy both the licence-text and copyright requirements. The survey's conclusion is this lib's
design rule: LICENCE FILES AND NOTICES, NOT METADATA, ARE THE SOURCE OF LEGAL TRUTH.
It is also what the librarian measured directly: of 26 NAVER releases, 2 carried any licence string
on the listing, and the one we then FETCHED turned out to be 483 bytes off the canonical Apache text
because it adds a copyright preamble and drops the appendix. A declaration is a claim; bytes are not.
THREE OUTCOMES, AND ONLY ONE OF THEM IS AN ANSWER:
DETECTED exactly one licence's REQUIRE markers all matched and none of its EXCLUDE markers did
UNKNOWN nothing matched -- fail-closed, the artifact does NOT advance to evidence=READ
AMBIGUOUS two or more matched -- ALSO fail-closed. A text matching two licences is not a decision,
and taking the first would be a coin flip wearing a verdict.
MARKERS ARE DATA (knowledge/license_markers.conf), so a new licence costs a row and never a rebuild,
and every marker set is auditable by a human reading the conf rather than the binary.
NO GUESSED CAPS: every array here is sized from the CONF'S OWN LINE COUNT, counted before allocation.
A marker table cannot overflow a bound derived from the file that defines it.
license_tier: ORIGINAL
dependencies 1 imports · 2 importers
imports: nx_syscalls.nx
imported by: nx_licdetect.nxnx_licdetect_gate.nx
structs
| none |
consts
| 25 | const LD_DETECTED: i64 = 0 |
| 26 | const LD_UNKNOWN: i64 = 1 |
| 27 | const LD_AMBIGUOUS: i64 = 2 |
| 29 | const LD_TAB: i64 = 9 |
| 30 | const LD_NL: i64 = 10 |
| 31 | const LD_HASH: i64 = 35 |
| 32 | const LD_M: i64 = 77 // 'M' marker row |
| 33 | const LD_V: i64 = 86 // 'V' verified-against row |
| 34 | const LD_WORD: i64 = 8 |
| 35 | const LD_ROW_STRIDE: i64 = 5 // lic_off, lic_len, kind, mk_off, mk_len |
| 36 | const LD_KIND_REQUIRE: i64 = 1 |
| 37 | const LD_KIND_EXCLUDE: i64 = 2 |
| 38 | const LD_CTX_SLOTS: i64 = 8 // buf, n, rows, nrows, vrows, nv |
functions
| 40 | func ld_streq_n(a: *u8, ao: i64, an: i64, b: *u8, bo: i64, bn: i64) -> i64 |
| 48 | func ld_contains(text: *u8, n: i64, buf: *u8, mo: i64, mn: i64) -> i64 called by 1: ld_detect |
| 66 | func ld_field(buf: *u8, s: i64, e: i64, idx: i64, box: *i64) -> i64 called by 1: ld_ctx |
| 82 | func ld_ctx() -> *i64 |
| 160 | func ld_marker_set_verified(ctx: *i64, lo: i64, ll: i64) -> i64 |
| 174 | func ld_detect(ctx: *i64, text: *u8, n: i64, out: *i64) -> i64 |
| 224 | func ld_result_name(r: i64) -> *u8 called by 1: main |