leptris 1.9.354.0-ppc64le-linux → 1.9.355.0-ppc64le-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/Rakefile +1 -1
- data/lib/leptris/version.rb +1 -1
- data/lib/libleptris.so +0 -0
- data/vendor-src/README.md +1 -1
- data/vendor-src/libleptris/AGENT.md +24 -0
- data/vendor-src/libleptris/CHANGELOG.md +47 -0
- data/vendor-src/libleptris/CLAUDE.md +15 -1
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/src/leptris/flat/direct_parse.c +29 -4
- data/vendor-src/libleptris/src/leptris/rng/parse.c +63 -4
- data/vendor-src/libleptris/src/leptris/xsd/compile.c +85 -0
- data/vendor-src/libleptris/test/parser/test_parser.cpp +50 -0
- data/vendor-src/libleptris/test/rng/include-cases/comb3-choice-outer.rng +8 -0
- data/vendor-src/libleptris/test/rng/include-cases/comb3-inner.rng +5 -0
- data/vendor-src/libleptris/test/rng/include-cases/comb3-mid.rng +11 -0
- data/vendor-src/libleptris/test/rng/include-cases/comb3-outer.rng +11 -0
- data/vendor-src/libleptris/test/rng/test_rng.cpp +33 -0
- data/vendor-src/libleptris/test/xsd/test_xsd_compile.cpp +10 -8
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +6 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9fbd247c0dbdbc145f3493538bbd76b1358af79765d2d6605373f7d359b8689a
|
|
4
|
+
data.tar.gz: 4e12fa371b515f080adaa61a1a5f9427e3f64785ba4779c3bcb723bb15a25fa8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9ecbf3034d45e54c8265bd4bb822f96cc4eae56965cb9eb58ed2ac1f6ed634126d8eaf2c92069a9cc571556673ed8d956d65518ac6adb6099aecba1dd6801d5a
|
|
7
|
+
data.tar.gz: 1b37a7e199f6de387b009570b85b167e8c9531638a2c3c8f3f56339897491a0a90ca929767e28789cae91b91eb1223ee379d178a951f4b596b6183fd1db587ce
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## [1.9.355.0] - 2026-10-14
|
|
2
|
+
|
|
3
|
+
### Fixed — engine sync (libleptris 1.9.355)
|
|
4
|
+
|
|
5
|
+
- **RelaxNG combine across multi-hop include chains
|
|
6
|
+
(leptris/leptris#1703, libleptris PR #1705)**: nested
|
|
7
|
+
`<define combine=...>` inside `<include>` now MERGES per spec
|
|
8
|
+
§4.2 instead of replacing — multi-hop chains keep every
|
|
9
|
+
interleave branch and choice union (the relaton-ieee `<ics>`
|
|
10
|
+
cardinality and the BIPM locality enumeration validate to Jing
|
|
11
|
+
parity; unblocks the last 2 of relaton's 40 Jing-swap flavors).
|
|
12
|
+
- **Strict-path tag-mismatch diagnostics (leptris/leptris#1700,
|
|
13
|
+
libleptris PR #1702)**: mismatched closing tags raise
|
|
14
|
+
"Opening and ending tag mismatch: expected </x>, got </y>" with
|
|
15
|
+
line:column, instead of "malformed input" at a byte offset.
|
|
16
|
+
- **XSD conformance slice 2 (libleptris PR #1698)**: src-include.1
|
|
17
|
+
(included targetNamespace must equal the includer's or be absent)
|
|
18
|
+
and the xsi-namespace reservation; engine conformance floor
|
|
19
|
+
803/1056 against the libxml2 oracle.
|
|
20
|
+
|
|
1
21
|
## [1.9.353.0] - 2026-10-14
|
|
2
22
|
|
|
3
23
|
### Added — engine sync (libleptris 1.9.353)
|
data/Rakefile
CHANGED
|
@@ -8,7 +8,7 @@ RSpec::Core::RakeTask.new(:spec)
|
|
|
8
8
|
# Pin for `rake compile` and the platform-gem builds. Keep in lockstep
|
|
9
9
|
# with .github/workflows/build.yml (which calls `rake compile`) and the
|
|
10
10
|
# CHANGELOG when libleptris releases.
|
|
11
|
-
LIBLEPTRIS_VERSION = "1.9.
|
|
11
|
+
LIBLEPTRIS_VERSION = "1.9.355"
|
|
12
12
|
# Vendored alongside libleptris for fn:normalize-unicode (TODO
|
|
13
13
|
# .restructure/20): built per platform with a RELOCATABLE @rpath
|
|
14
14
|
# install name, loaded by ffi.rb before libleptris so the
|
data/lib/leptris/version.rb
CHANGED
data/lib/libleptris.so
CHANGED
|
Binary file
|
data/vendor-src/README.md
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Agent working agreement (leptris engine + bindings)
|
|
2
|
+
|
|
3
|
+
## Binding version sync (law)
|
|
4
|
+
|
|
5
|
+
`leptris-ruby`, `leptris-py`, and `leptris-ts` pin the engine by
|
|
6
|
+
version. The pins move in the same wave as the engine release they
|
|
7
|
+
need: engine fix → release X.Y.Z → every binding pin bumps to X.Y.Z
|
|
8
|
+
in the same session. A binding pin never lags main by more than one
|
|
9
|
+
engine release.
|
|
10
|
+
|
|
11
|
+
## Session ownership
|
|
12
|
+
|
|
13
|
+
The engine session OWNS the binding repos' engineering work
|
|
14
|
+
(leptris-ruby, leptris-py, leptris-ts): branches, CI, PRs, merges.
|
|
15
|
+
Publication (rubygems/PyPI/npm) stays owner-gated — the owner runs
|
|
16
|
+
releases or hands over the exact version.
|
|
17
|
+
|
|
18
|
+
## Standing rules (see CLAUDE.md for the full contract)
|
|
19
|
+
|
|
20
|
+
- Every fix: branch → red-first specs → full gates → PR → CI green →
|
|
21
|
+
rebase-merge → release ride.
|
|
22
|
+
- Never commit to main, never push tags, never add AI attribution.
|
|
23
|
+
- Binding publications (gem/PyPI/npm) are the owner's decision and
|
|
24
|
+
the owner's command.
|
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.9.355] - 2026-10-14
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **RelaxNG: combine=interleave/choice merge across multi-hop
|
|
8
|
+
include chains (leptris#1703, PR #1705).** A nested
|
|
9
|
+
`<define combine=...>` inside `<include>` replaced the included
|
|
10
|
+
definition unconditionally and dropped its combine — every hop of
|
|
11
|
+
a multi-hop chain (relaton-ieee: compile -> flavor -> standoc ->
|
|
12
|
+
biblio -> basicdoc, basicdoc reachable through two paths) lost the
|
|
13
|
+
accumulated body: interleaved cardinalities collapsed to the
|
|
14
|
+
outermost branch (the 2nd/3rd `<ics>` rejections) and choice
|
|
15
|
+
unions collapsed to one alternative (the BIPM locality type
|
|
16
|
+
enumeration). Jing accepts both documents; leptris now does too.
|
|
17
|
+
The merge keeps the combinator wrapper as the define body and
|
|
18
|
+
flattens same-kind combinators at each merge (both associative),
|
|
19
|
+
so the validator's single-pass interleave walk judges one flat
|
|
20
|
+
scope. The absorb helper frees the absorbed wrapper fully
|
|
21
|
+
detached — the first cut's use-after-scope was caught by the
|
|
22
|
+
Linux ASAN lane.
|
|
23
|
+
|
|
24
|
+
- **Strict parse: tag-mismatch failures name the tags
|
|
25
|
+
(leptris#1700, PR #1702).** A stray or mismatched closing tag on
|
|
26
|
+
the strict path failed with "XML parse error at byte N: malformed
|
|
27
|
+
input" — reading like encoding corruption. The failure now
|
|
28
|
+
carries "Opening and ending tag mismatch: expected </x>, got
|
|
29
|
+
</y>" (the Nokogiri/Jing convention) with the byte offset and
|
|
30
|
+
line:column retained; every other strict failure stays generic,
|
|
31
|
+
and depth-0 stray closes match the oracle's two-message behavior.
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- **XSD conformance slice 2: src-include.1 + xsi reservation
|
|
36
|
+
(PR #1698).** The included/redefined schema's targetNamespace
|
|
37
|
+
must equal the includer's — or be absent (the chameleon form
|
|
38
|
+
adopts the includer's) — and a schema whose own targetNamespace
|
|
39
|
+
is the xsi namespace fails at load. Conformance floor
|
|
40
|
+
795 -> 803/1056 (schema-error class 34/206); the compile floor is
|
|
41
|
+
now the cross-platform minimum after the Linux ASAN run showed
|
|
42
|
+
case-sensitive schemaLocation resolution rejecting 4 fixtures
|
|
43
|
+
macOS silently accepted (finding noted in #1691).
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- (describe changes here)
|
|
48
|
+
|
|
49
|
+
|
|
3
50
|
## [1.9.354] - 2026-10-14
|
|
4
51
|
|
|
5
52
|
### Fixed
|
|
@@ -66,7 +66,7 @@ Core (src/leptris/) → DOM, parser, XPath engine, SAX, DTD, encoding, memor
|
|
|
66
66
|
- `encoding/` — UTF-16 always compiled; `encoding.c` (iconv) only when `LEPTRIS_ENABLE_ICONV` is on.
|
|
67
67
|
- `unicode/unicode.c` — only compiled when `LEPTRIS_ENABLE_UTF8PROC` is on.
|
|
68
68
|
- `memory/` — `pool.c` (O(1) arena allocator used pervasively) and `compact_allocator.c`.
|
|
69
|
-
- `xinclude/` — built and shipping. `parse="text"` with `xi:fallback
|
|
69
|
+
- `xinclude/` — built and shipping. `parse="text"` and `parse="xml"` with `xi:fallback`, the element()/xpointer() schemes, and depth-bounded loop protection work end-to-end (28-spec suite). Remaining: xml:base chain resolution and the pluggable resolver/catalog policy (TODO.assemble phases 03/04).
|
|
70
70
|
|
|
71
71
|
### Public API surface (`src/include/leptris/`)
|
|
72
72
|
The public contract. Don't break ABI without a major bump. Headers split by subsystem: `dom/{document,element,serialize}.h`, `xpath/xpath.h`, `sax/sax.h`, `html.h`, plus `types.h`, `error.h`, `dtd.h` at the top level. All handles are opaque typedefs (`LeptrisDocument`, `LeptrisElement`, `LeptrisNodeRef`, …); callers never see struct definitions.
|
|
@@ -101,6 +101,20 @@ The public contract. Don't break ABI without a major bump. Headers split by subs
|
|
|
101
101
|
- `VALIDATION.md` — exact commands to run individual test suites and benchmarks, plus expected results.
|
|
102
102
|
- `benchmarks/README.{md,adoc}` — benchmark methodology and reference comparisons.
|
|
103
103
|
|
|
104
|
+
## Binding version sync — ruby / python / ts always ride together
|
|
105
|
+
|
|
106
|
+
The binding repos (`leptris-ruby`, `leptris-py`, `leptris-ts`) pin the
|
|
107
|
+
engine by version (gem `1.9.x.y.0`, npm `ENGINE_VERSION`, py wheel pin).
|
|
108
|
+
**The pins move in the same wave as the engine release they need** — a
|
|
109
|
+
binding pin never lags main by more than one engine release. When the
|
|
110
|
+
engine cuts X.Y.Z, every binding that needs the content bumps its pin to
|
|
111
|
+
X.Y.Z in the same session (branch → CI → PR → merge; gem/npm publication
|
|
112
|
+
stays owner-gated).
|
|
113
|
+
|
|
114
|
+
Agent sessions for leptris-ruby and leptris-py are consolidated into the
|
|
115
|
+
engine session — the same session drives engine fix → release → binding
|
|
116
|
+
pin rides, so a binding never ships a stale engine.
|
|
117
|
+
|
|
104
118
|
## Releasing — ALWAYS use the automated workflow
|
|
105
119
|
|
|
106
120
|
**NEVER create git tags or GitHub releases manually.** No `git tag`, no
|
|
@@ -115,6 +115,12 @@ typedef struct {
|
|
|
115
115
|
* documents >= 2 GiB (offsets don't fit; line reads return
|
|
116
116
|
* unknown, matching the pre-#223 behavior). */
|
|
117
117
|
int line_offsets_ok;
|
|
118
|
+
/* leptris#1700: a strict-path failure may carry a specific
|
|
119
|
+
* diagnostic (tag mismatch) instead of the generic message.
|
|
120
|
+
* Storage lives IN the parser struct: the fail goto jumps out
|
|
121
|
+
* of the setting block's scope, so a stack pointer there would
|
|
122
|
+
* be use-after-scope (the Linux ASAN lane caught exactly that). */
|
|
123
|
+
char strict_fail_msg[192];
|
|
118
124
|
int had_declaration;
|
|
119
125
|
/* Bulk-allocated attribute block. Pre-allocated from pool so the
|
|
120
126
|
* common case is a bump-pointer off the block — no per-attr
|
|
@@ -1635,6 +1641,7 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
|
|
|
1635
1641
|
p.drop_ws_text = drop_ws_text;
|
|
1636
1642
|
p.keep_entity_refs = keep_entity_refs;
|
|
1637
1643
|
p.recover = recover;
|
|
1644
|
+
p.strict_fail_msg[0] = '\0';
|
|
1638
1645
|
p.dtd = NULL;
|
|
1639
1646
|
/* Only ever set to 1 in the loop; without the zero here the
|
|
1640
1647
|
* field rides the stack (MSVC C4701) and doc->has_namespaces
|
|
@@ -2077,8 +2084,19 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
|
|
|
2077
2084
|
* A close tag naming an open ANCESTOR closes the
|
|
2078
2085
|
* intermediates implicitly (libxml2 semantics); a
|
|
2079
2086
|
* close matching nothing open is dropped. Either way
|
|
2080
|
-
* the recovery records a diagnostic.
|
|
2081
|
-
|
|
2087
|
+
* the recovery records a diagnostic.
|
|
2088
|
+
* leptris#1700: the STRICT path fails with the same
|
|
2089
|
+
* mismatch named — tag names + line:column ride the
|
|
2090
|
+
* error message, not a bare byte offset. */
|
|
2091
|
+
if (!p.recover) {
|
|
2092
|
+
snprintf(p.strict_fail_msg,
|
|
2093
|
+
sizeof(p.strict_fail_msg),
|
|
2094
|
+
"Opening and ending tag mismatch: expected "
|
|
2095
|
+
"</%.*s>, got </%.*s>",
|
|
2096
|
+
(int)open_len, open_name,
|
|
2097
|
+
(int)close_local_len, close_local);
|
|
2098
|
+
goto fail;
|
|
2099
|
+
}
|
|
2082
2100
|
{
|
|
2083
2101
|
int anc = -1;
|
|
2084
2102
|
for (int d = (int)p.depth - 1; d >= 0; d--) {
|
|
@@ -2447,9 +2465,16 @@ fail:
|
|
|
2447
2465
|
* thread-local slot so bindings can read leptris_last_error()
|
|
2448
2466
|
* when leptris_parse_string returns NULL. */
|
|
2449
2467
|
{
|
|
2450
|
-
char msg[
|
|
2468
|
+
char msg[256];
|
|
2451
2469
|
long off = (long)(p.pos ? p.pos - p.buf : 0);
|
|
2452
|
-
|
|
2470
|
+
if (p.strict_fail_msg[0]) {
|
|
2471
|
+
snprintf(msg, sizeof(msg),
|
|
2472
|
+
"XML parse error at byte %ld: %s",
|
|
2473
|
+
off, p.strict_fail_msg);
|
|
2474
|
+
} else {
|
|
2475
|
+
snprintf(msg, sizeof(msg),
|
|
2476
|
+
"XML parse error at byte %ld: malformed input", off);
|
|
2477
|
+
}
|
|
2453
2478
|
leptris_set_error(LEPTRIS_ERROR_PARSE_FAILED, msg);
|
|
2454
2479
|
/* 1-based line/column of the failure (issue #510). */
|
|
2455
2480
|
int line = 1, column = 1;
|
|
@@ -255,6 +255,32 @@ static void merge_start(RngGrammar* g, RngPattern* body) {
|
|
|
255
255
|
g->start = ch;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
+
/* INTERLEAVE and CHOICE are associative: a merge wrapper whose
|
|
259
|
+
* child list already carries a same-kind combinator flattens into
|
|
260
|
+
* the parent scope. The validator's single-pass interleave walk has
|
|
261
|
+
* no backtracking across nested scopes, so a nested combinator from
|
|
262
|
+
* a multi-hop chain would reject documents the flat form accepts
|
|
263
|
+
* (leptris#1703). */
|
|
264
|
+
static void rng_flatten_combinator(RngPattern* wrap) {
|
|
265
|
+
RngPattern** link = &wrap->first_child;
|
|
266
|
+
while (*link) {
|
|
267
|
+
RngPattern* c = *link;
|
|
268
|
+
if (c->kind == wrap->kind && c->first_child) {
|
|
269
|
+
RngPattern* tail = c->first_child;
|
|
270
|
+
while (tail->next) tail = tail->next;
|
|
271
|
+
tail->next = c->next;
|
|
272
|
+
*link = c->first_child;
|
|
273
|
+
/* detach fully — rng_pattern_free recurses into next,
|
|
274
|
+
* which here is the REST of the sibling chain */
|
|
275
|
+
c->first_child = NULL;
|
|
276
|
+
c->next = NULL;
|
|
277
|
+
rng_pattern_free(c);
|
|
278
|
+
continue; /* re-check the spliced head */
|
|
279
|
+
}
|
|
280
|
+
link = &c->next;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
258
284
|
/* Add/merge a <define>. Takes ownership of name, combine and the
|
|
259
285
|
* GROUP wrapper body. Returns 0 with err set on an uncombined
|
|
260
286
|
* redefinition. */
|
|
@@ -307,6 +333,7 @@ static int add_define(RngGrammar* g, char* name, char* combine,
|
|
|
307
333
|
pat_append(wrap, body->first_child);
|
|
308
334
|
body->first_child = NULL;
|
|
309
335
|
rng_pattern_free(body);
|
|
336
|
+
rng_flatten_combinator(wrap);
|
|
310
337
|
d->body = wrap;
|
|
311
338
|
return 1;
|
|
312
339
|
}
|
|
@@ -436,10 +463,42 @@ static int handle_include(RngGrammar* g, LeptrisElement inc,
|
|
|
436
463
|
rng_grammar_free(ig);
|
|
437
464
|
return 0;
|
|
438
465
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
466
|
+
/* leptris#1703: @combine on the nested define merges with
|
|
467
|
+
* the included definition (spec §4.2) — replace only when
|
|
468
|
+
* NEITHER side carries a combine. The first cut replaced
|
|
469
|
+
* unconditionally, so every multi-hop include chain lost
|
|
470
|
+
* the accumulated body at each hop: interleaved
|
|
471
|
+
* cardinalities collapsed to the outermost branch and
|
|
472
|
+
* choice unions collapsed to one alternative. The merged
|
|
473
|
+
* define KEEPS the combine value so further hops keep
|
|
474
|
+
* merging. */
|
|
475
|
+
char* ncombine = dup_attr(ce, "combine");
|
|
476
|
+
if (ncombine && ncombine[0]) {
|
|
477
|
+
/* The WRAPPER stays as the define's body — same shape
|
|
478
|
+
* add_define produces — the combinator node is what
|
|
479
|
+
* the validator walks; unwrapping leaves bare
|
|
480
|
+
* siblings with no interleave/choice between them. */
|
|
481
|
+
RngPattern* wrap =
|
|
482
|
+
pat_new(strcmp(ncombine, "interleave") == 0
|
|
483
|
+
? RNG_INTERLEAVE
|
|
484
|
+
: RNG_CHOICE);
|
|
485
|
+
pat_append(wrap, d->body);
|
|
486
|
+
pat_append(wrap, body->first_child);
|
|
487
|
+
body->first_child = NULL;
|
|
488
|
+
rng_pattern_free(body);
|
|
489
|
+
rng_flatten_combinator(wrap);
|
|
490
|
+
free(d->combine);
|
|
491
|
+
d->combine = ncombine;
|
|
492
|
+
d->body = wrap;
|
|
493
|
+
} else {
|
|
494
|
+
free(ncombine);
|
|
495
|
+
free(d->combine);
|
|
496
|
+
d->combine = NULL;
|
|
497
|
+
rng_pattern_free(d->body);
|
|
498
|
+
d->body = body->first_child;
|
|
499
|
+
body->first_child = NULL;
|
|
500
|
+
rng_pattern_free(body);
|
|
501
|
+
}
|
|
443
502
|
} else {
|
|
444
503
|
snprintf(err, errsz, "include %s: unexpected <%s>", href,
|
|
445
504
|
leptris_element_name(ce));
|
|
@@ -726,6 +726,72 @@ static int xsd_uint_attr(LeptrisElement e, const char* name, int* out) {
|
|
|
726
726
|
return 1;
|
|
727
727
|
}
|
|
728
728
|
|
|
729
|
+
/* src-include.1 (conformance lane schema-error class, #1691):
|
|
730
|
+
* the included/redefined schema's targetNamespace must equal the
|
|
731
|
+
* includer's — or be absent. Checked on the root's top-level
|
|
732
|
+
* include/redefine instructions; the subfile is parsed once here
|
|
733
|
+
* purely for the tns verdict (the capture pass re-reads it). */
|
|
734
|
+
static int xsd_check_include_tns(struct leptris_xsd_schema* s,
|
|
735
|
+
LeptrisElement root) {
|
|
736
|
+
for (LeptrisNodeRef n =
|
|
737
|
+
leptris_node_first_child(leptris_element_as_node(root));
|
|
738
|
+
n; n = leptris_node_next_sibling(n)) {
|
|
739
|
+
if (leptris_node_get_type(n) != LEPTRIS_NODE_TYPE_ELEMENT)
|
|
740
|
+
continue;
|
|
741
|
+
LeptrisElement c = (LeptrisElement)n;
|
|
742
|
+
const char* local = NULL;
|
|
743
|
+
const char* prefix = NULL;
|
|
744
|
+
const char* uri = NULL;
|
|
745
|
+
leptris_element_expanded_name(c, &local, &prefix, &uri);
|
|
746
|
+
if (!local || !uri || strcmp(uri, XSD_NS) != 0)
|
|
747
|
+
continue;
|
|
748
|
+
if (strcmp(local, "include") != 0 && strcmp(local, "redefine") != 0)
|
|
749
|
+
continue;
|
|
750
|
+
const char* loc =
|
|
751
|
+
leptris_element_attribute(c, "schemaLocation");
|
|
752
|
+
if (!loc || !s->base_dir)
|
|
753
|
+
continue;
|
|
754
|
+
char path[4096];
|
|
755
|
+
snprintf(path, sizeof(path), "%s/%s", s->base_dir, loc);
|
|
756
|
+
size_t flen = 0;
|
|
757
|
+
char* text = xsd_read_file(path, &flen);
|
|
758
|
+
if (!text) continue;
|
|
759
|
+
LeptrisDocument sub = leptris_parse_string(text, flen, NULL);
|
|
760
|
+
free(text);
|
|
761
|
+
if (!sub) continue;
|
|
762
|
+
LeptrisElement subroot = leptris_document_root(sub);
|
|
763
|
+
const char* sub_tns =
|
|
764
|
+
subroot ? leptris_element_attribute(subroot,
|
|
765
|
+
"targetNamespace")
|
|
766
|
+
: NULL;
|
|
767
|
+
int err = 0;
|
|
768
|
+
char msg[512];
|
|
769
|
+
if (s->target_ns && sub_tns && s->target_ns[0] && sub_tns[0] &&
|
|
770
|
+
strcmp(sub_tns, s->target_ns) != 0) {
|
|
771
|
+
snprintf(msg, sizeof(msg),
|
|
772
|
+
"src-include.1: the target namespace '%s' of the "
|
|
773
|
+
"included/redefined schema '%s' differs from '%s' "
|
|
774
|
+
"of the including schema",
|
|
775
|
+
sub_tns, loc, s->target_ns);
|
|
776
|
+
err = 1;
|
|
777
|
+
} else if ((!s->target_ns || !s->target_ns[0]) && sub_tns &&
|
|
778
|
+
sub_tns[0]) {
|
|
779
|
+
snprintf(msg, sizeof(msg),
|
|
780
|
+
"src-include.1: the target namespace '%s' of the "
|
|
781
|
+
"included/redefined schema '%s' has to be absent, "
|
|
782
|
+
"since the including schema has no target namespace",
|
|
783
|
+
sub_tns, loc);
|
|
784
|
+
err = 1;
|
|
785
|
+
}
|
|
786
|
+
leptris_document_free(sub);
|
|
787
|
+
if (err) {
|
|
788
|
+
xsd_set_error(s, msg);
|
|
789
|
+
return -1;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
return 0;
|
|
793
|
+
}
|
|
794
|
+
|
|
729
795
|
/* Schema-structure constraints (the conformance lane's schema-error
|
|
730
796
|
* class, #1691): the xs:-vocabulary rules the oracle enforces at
|
|
731
797
|
* load. First violation wins; the message names the rule. */
|
|
@@ -854,6 +920,25 @@ static LeptrisXsdSchema xsd_compile_impl(const char* xsd_text,
|
|
|
854
920
|
if (xsd_check_structure(s, root) != 0)
|
|
855
921
|
goto fail;
|
|
856
922
|
|
|
923
|
+
/* Schema Component Constraint: xsi: Not Allowed — the schema's
|
|
924
|
+
* own targetNamespace must never be the xsi namespace
|
|
925
|
+
* (scc-no-xsi). */
|
|
926
|
+
if (s->target_ns &&
|
|
927
|
+
strcmp(s->target_ns,
|
|
928
|
+
"http://www.w3.org/2001/XMLSchema-instance") == 0) {
|
|
929
|
+
xsd_set_error(
|
|
930
|
+
s,
|
|
931
|
+
"scc-no-xsi: the target namespace must not be "
|
|
932
|
+
"'http://www.w3.org/2001/XMLSchema-instance'");
|
|
933
|
+
goto fail;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
/* src-include.1: the included/redefined schema's
|
|
937
|
+
* targetNamespace must equal the includer's — or be absent
|
|
938
|
+
* (the chameleon form adopts the includer's at capture). */
|
|
939
|
+
if (xsd_check_include_tns(s, root) != 0)
|
|
940
|
+
goto fail;
|
|
941
|
+
|
|
857
942
|
xsd_capture_root(s, root);
|
|
858
943
|
xsd_resolve_extension_bases(s);
|
|
859
944
|
|
|
@@ -850,3 +850,53 @@ TEST(ParseRecover, WithoutFlagStillFails) {
|
|
|
850
850
|
LEPTRIS_PARSE_DEFAULT, &st);
|
|
851
851
|
EXPECT_EQ(doc, nullptr);
|
|
852
852
|
}
|
|
853
|
+
|
|
854
|
+
/* ---- leptris#1700: strict-path mismatch diagnostics -------------- */
|
|
855
|
+
|
|
856
|
+
TEST(ParseErrorPosition, StrictMismatchNamesTheTags) {
|
|
857
|
+
/* A close naming nothing open INSIDE an element: the message
|
|
858
|
+
* names the expected close and the one received, not a bare
|
|
859
|
+
* "malformed input" at a byte offset. (A stray close at depth 0
|
|
860
|
+
* — extra content after a complete document — fails the
|
|
861
|
+
* depth-0 check before the mismatch path and stays generic.) */
|
|
862
|
+
const char xml[] = "<r><a></b></a></r>";
|
|
863
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
864
|
+
LeptrisDocument doc = leptris_parse_string(xml, std::strlen(xml), &st);
|
|
865
|
+
EXPECT_EQ(doc, nullptr);
|
|
866
|
+
EXPECT_EQ(st, LEPTRIS_ERROR_PARSE);
|
|
867
|
+
|
|
868
|
+
const char* err = leptris_last_error();
|
|
869
|
+
ASSERT_NE(err, nullptr);
|
|
870
|
+
EXPECT_NE(std::strstr(err, "expected </a>"), nullptr) << err;
|
|
871
|
+
EXPECT_NE(std::strstr(err, "got </b>"), nullptr) << err;
|
|
872
|
+
|
|
873
|
+
int line = -1, column = -1;
|
|
874
|
+
leptris_last_error_position(&line, &column);
|
|
875
|
+
EXPECT_EQ(line, 1);
|
|
876
|
+
EXPECT_GT(column, 1);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
TEST(ParseErrorPosition, StrictMismatchNamesTheAncestor) {
|
|
880
|
+
/* The close names an ancestor: the message names the open
|
|
881
|
+
* element and the close that didn't match it. */
|
|
882
|
+
const char xml[] = "<bibdata><ext>t</bibdata>";
|
|
883
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
884
|
+
LeptrisDocument doc = leptris_parse_string(xml, std::strlen(xml), &st);
|
|
885
|
+
EXPECT_EQ(doc, nullptr);
|
|
886
|
+
|
|
887
|
+
const char* err = leptris_last_error();
|
|
888
|
+
ASSERT_NE(err, nullptr);
|
|
889
|
+
EXPECT_NE(std::strstr(err, "expected </ext>"), nullptr) << err;
|
|
890
|
+
EXPECT_NE(std::strstr(err, "got </bibdata>"), nullptr) << err;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
TEST(ParseErrorPosition, GenericFailuresStayGeneric) {
|
|
894
|
+
const char xml[] = "<r><a/></r";
|
|
895
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
896
|
+
LeptrisDocument doc = leptris_parse_string(xml, std::strlen(xml), &st);
|
|
897
|
+
EXPECT_EQ(doc, nullptr);
|
|
898
|
+
|
|
899
|
+
const char* err = leptris_last_error();
|
|
900
|
+
ASSERT_NE(err, nullptr);
|
|
901
|
+
EXPECT_NE(std::strstr(err, "malformed input"), nullptr) << err;
|
|
902
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="">
|
|
3
|
+
<include href="comb3-inner.rng">
|
|
4
|
+
<define name="content" combine="choice">
|
|
5
|
+
<element name="b"><empty/></element>
|
|
6
|
+
</define>
|
|
7
|
+
</include>
|
|
8
|
+
</grammar>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="">
|
|
3
|
+
<start><element name="root"><ref name="content"/></element></start>
|
|
4
|
+
<define name="content"><zeroOrMore><element name="a"><empty/></element></zeroOrMore></define>
|
|
5
|
+
</grammar>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="">
|
|
3
|
+
<include href="comb3-inner.rng">
|
|
4
|
+
<define name="content" combine="interleave">
|
|
5
|
+
<zeroOrMore><element name="b"><empty/></element></zeroOrMore>
|
|
6
|
+
</define>
|
|
7
|
+
</include>
|
|
8
|
+
<define name="content" combine="interleave">
|
|
9
|
+
<zeroOrMore><element name="c"><empty/></element></zeroOrMore>
|
|
10
|
+
</define>
|
|
11
|
+
</grammar>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="">
|
|
3
|
+
<include href="comb3-mid.rng">
|
|
4
|
+
<define name="content" combine="interleave">
|
|
5
|
+
<zeroOrMore><element name="d"><empty/></element></zeroOrMore>
|
|
6
|
+
</define>
|
|
7
|
+
</include>
|
|
8
|
+
<define name="content" combine="interleave">
|
|
9
|
+
<zeroOrMore><element name="e"><empty/></element></zeroOrMore>
|
|
10
|
+
</define>
|
|
11
|
+
</grammar>
|
|
@@ -1378,3 +1378,36 @@ TEST(RngRegex, ExactQuantifierIsClosed) {
|
|
|
1378
1378
|
EXPECT_EQ(rng_regex_matches("a{2}", "aa"), 1);
|
|
1379
1379
|
EXPECT_EQ(rng_regex_matches("a{2}", "aaa"), 0);
|
|
1380
1380
|
}
|
|
1381
|
+
|
|
1382
|
+
/* ---- leptris#1703: combine across multi-hop include chains ------- */
|
|
1383
|
+
|
|
1384
|
+
TEST(RngIncludeMultiHop, InterleaveSurvivesThreeHops) {
|
|
1385
|
+
/* inner defines a; mid's nested include-define interleave-adds b,
|
|
1386
|
+
* mid's own define interleave-adds c; outer's nested include-
|
|
1387
|
+
* define interleave-adds d, outer's own define interleave-adds
|
|
1388
|
+
* e. The first cut dropped every accumulated body at each
|
|
1389
|
+
* include's nested-define REPLACE — permissions vanished. */
|
|
1390
|
+
EXPECT_EQ(file_validates("comb3-outer.rng",
|
|
1391
|
+
"<root><a/><b/><c/><d/><e/></root>"),
|
|
1392
|
+
1);
|
|
1393
|
+
/* Every member must also be accepted alone (cardinality is
|
|
1394
|
+
* zeroOrMore per branch, not singleton). */
|
|
1395
|
+
EXPECT_EQ(file_validates("comb3-outer.rng", "<root><b/><d/></root>"),
|
|
1396
|
+
1);
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
TEST(RngIncludeMultiHop, InterleaveRejectsUnknownElement) {
|
|
1400
|
+
EXPECT_EQ(file_validates("comb3-outer.rng", "<root><z/></root>"),
|
|
1401
|
+
0);
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
TEST(RngIncludeMultiHop, ChoiceUnionSurvivesIncludeHop) {
|
|
1405
|
+
/* inner allows a; the include's nested define choice-adds b —
|
|
1406
|
+
* the union must hold both. */
|
|
1407
|
+
EXPECT_EQ(file_validates("comb3-choice-outer.rng", "<root><a/></root>"),
|
|
1408
|
+
1);
|
|
1409
|
+
EXPECT_EQ(file_validates("comb3-choice-outer.rng", "<root><b/></root>"),
|
|
1410
|
+
1);
|
|
1411
|
+
EXPECT_EQ(file_validates("comb3-choice-outer.rng", "<root><z/></root>"),
|
|
1412
|
+
0);
|
|
1413
|
+
}
|
|
@@ -144,14 +144,16 @@ TEST(Libxml2Corpus, EveryFixtureCompilesOrFailsCleanly) {
|
|
|
144
144
|
EXPECT_GE(ok + failed, 160u) << "fixture set shrank";
|
|
145
145
|
// Compile floor: was 163/163 when compile was unconditional —
|
|
146
146
|
// the structure check (#1691) now legitimately rejects the
|
|
147
|
-
// schema-error fixtures
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
//
|
|
151
|
-
//
|
|
147
|
+
// schema-error fixtures. The floor is the CROSS-PLATFORM
|
|
148
|
+
// minimum: Linux (case-sensitive fs) resolves 4 more fixtures'
|
|
149
|
+
// schemaLocations than macOS, where they silently fail to load
|
|
150
|
+
// and the violations go unseen — Linux ok=155, macOS 159 (the
|
|
151
|
+
// delta is tracked in #1691: fixture case mismatches + a
|
|
152
|
+
// missing-include diagnostic). The differential expectations
|
|
153
|
+
// live in XsdConformance (MANIFEST.tsv). Monotonic.
|
|
152
154
|
RecordProperty("ok", std::to_string(ok));
|
|
153
155
|
RecordProperty("failed", std::to_string(failed));
|
|
154
|
-
EXPECT_GE(ok,
|
|
156
|
+
EXPECT_GE(ok, 155u) << "compile-success floor regressed";
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
} // namespace
|
|
@@ -2014,10 +2016,10 @@ TEST(XsdConformance, ManifestExpectationsMatchOracle) {
|
|
|
2014
2016
|
* schema-constraint gate is laxer than the oracle's; see the
|
|
2015
2017
|
* divergence tracker). Monotonically rising — each fix here
|
|
2016
2018
|
* retires oracle divergences wholesale. */
|
|
2017
|
-
EXPECT_GE(pass,
|
|
2019
|
+
EXPECT_GE(pass, 803) << "conformance floor regressed";
|
|
2018
2020
|
EXPECT_GE(pass_valid, 151);
|
|
2019
2021
|
EXPECT_GE(pass_invalid, 618);
|
|
2020
|
-
EXPECT_GE(pass_schema_error,
|
|
2022
|
+
EXPECT_GE(pass_schema_error, 34);
|
|
2021
2023
|
RecordProperty("pass_valid", std::to_string(pass_valid));
|
|
2022
2024
|
RecordProperty("pass_invalid", std::to_string(pass_invalid));
|
|
2023
2025
|
RecordProperty("pass_schema_error", std::to_string(pass_schema_error));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
|
|
3
3
|
"name": "leptris",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.355",
|
|
5
5
|
"description": "High-performance XML parser and XPath 1.0 engine in C (libleptris)",
|
|
6
6
|
"homepage": "https://github.com/leptris/leptris",
|
|
7
7
|
"license": "MIT",
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: leptris
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.355.0
|
|
5
5
|
platform: ppc64le-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -193,6 +193,7 @@ files:
|
|
|
193
193
|
- rakelib/audit_artifacts.rb
|
|
194
194
|
- scripts/gem_smoke.rb
|
|
195
195
|
- vendor-src/README.md
|
|
196
|
+
- vendor-src/libleptris/AGENT.md
|
|
196
197
|
- vendor-src/libleptris/CHANGELOG.md
|
|
197
198
|
- vendor-src/libleptris/CLAUDE.md
|
|
198
199
|
- vendor-src/libleptris/CMakeLists.txt
|
|
@@ -833,6 +834,10 @@ files:
|
|
|
833
834
|
- vendor-src/libleptris/test/rng/include-cases/bad-construct.rng
|
|
834
835
|
- vendor-src/libleptris/test/rng/include-cases/bad-override.rng
|
|
835
836
|
- vendor-src/libleptris/test/rng/include-cases/bad-start-override.rng
|
|
837
|
+
- vendor-src/libleptris/test/rng/include-cases/comb3-choice-outer.rng
|
|
838
|
+
- vendor-src/libleptris/test/rng/include-cases/comb3-inner.rng
|
|
839
|
+
- vendor-src/libleptris/test/rng/include-cases/comb3-mid.rng
|
|
840
|
+
- vendor-src/libleptris/test/rng/include-cases/comb3-outer.rng
|
|
836
841
|
- vendor-src/libleptris/test/rng/include-cases/ext-lib.rng
|
|
837
842
|
- vendor-src/libleptris/test/rng/include-cases/ext-main.rng
|
|
838
843
|
- vendor-src/libleptris/test/rng/include-cases/lib.rng
|