leptris 1.9.345.1-aarch64-linux → 1.9.349.0-aarch64-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2686e5e82a469c5a21eed424c11f5bad6d985c0163031edba3ac9250ab06d6d0
4
- data.tar.gz: 761e638e60d9fc9f39cdf3ea26f242b7c4fc7865fce7747be2e1e6d98c9b729c
3
+ metadata.gz: e5cbf6d892fc8bc7ecf7dd5c3dfe9c17798643a3af2ba4d7caef568bb45983e5
4
+ data.tar.gz: 8525c0bb87334022b886f8d5788b67c60c4f3b6a42599d79dae266c177940cab
5
5
  SHA512:
6
- metadata.gz: bcb7f882c379b666de425d05488882277a84e5281ce01151ea81c0d1493b03d500e8c698dda3bfc35ca4a4b6a5f55b277cab43ed234fe00763467cb5d029374f
7
- data.tar.gz: a605717ef4349d231cfae0a91534936915228358fc2128a9b0a11f34ebb8e3cad4c4272e417cbf4d8f18be86ea0dc9e452699bd38e9394c4446c1ee4fc80205e
6
+ metadata.gz: 715112e2ec9014aef7b016dc30066356ef5b47e84b878ada9ac2c9be74242b7170cca7c7b9051659ce215a6ab654042c01edf73f1c7f2bfb047810c8beb1e9d0
7
+ data.tar.gz: ed727a38a867f996face9c3fa3530e81fba95bfd95ea7657a1ac2aeb3e6e9a50609a3760111b3d5b1c89299ef4c7515abbb30da98f4231be72553c0b388c8127
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [1.9.346.0] - 2026-10-12
2
+
3
+ ### Fixed — engine sync (libleptris 1.9.346)
4
+
5
+ - **Reserved prefixes resolve on declaration-free trees (#1664)**:
6
+ xml:lang on an HTML/WHATWG-parsed tree and on mutation-created
7
+ attributes (element_set_attribute) resolves to the XML
8
+ namespace — both creation paths stamp the colon-gated attribute
9
+ ns side-cache like the XML parse lane's fused loop. Pinned for
10
+ both lanes through the binding API.
11
+
1
12
  ## [1.9.345.1] - 2026-10-12
2
13
 
3
14
  ### Added
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.345"
11
+ LIBLEPTRIS_VERSION = "1.9.349"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.345.1"
4
+ VERSION = "1.9.349.0"
5
5
  end
@@ -494,6 +494,17 @@ module Leptris
494
494
  [:leptris_plan_result, :size_t], :leptris_plan_result
495
495
  attach_function :leptris_plan_value_attribute,
496
496
  [:leptris_plan_result, :string], UTF8_STRING
497
+ # #1670 (libleptris 1.9.347): the ELEMENT value's attribute
498
+ # census + one-call flat read (ParallelArrays mirrors
499
+ # children_snapshot: NULL blobs size, retry at the returned
500
+ # capacity; (size_t)-1 = still too small). Engine-face
501
+ # coverage — the plan-value consumer port rides the #425/#426
502
+ # Descriptor round.
503
+ attach_function :leptris_plan_value_attribute_count,
504
+ [:leptris_plan_result], :size_t
505
+ attach_function :leptris_plan_value_attributes_snapshot,
506
+ [:leptris_plan_result, :pointer, :size_t, :pointer, :pointer,
507
+ :size_t, :pointer], :size_t
497
508
  # One-call flat child list: names blob with per-child offsets
498
509
  # (SIZE_MAX = NULL name, i.e. content runs), type tags, and
499
510
  # borrowed child handles. Returns 0 on success or the blob
@@ -18,16 +18,29 @@ class Leptris::XML::PlanValue
18
18
  Leptris::XML::FFI::PLAN_VALUE_SCALAR => :scalar,
19
19
  Leptris::XML::FFI::PLAN_VALUE_COLLECTION => :collection,
20
20
  Leptris::XML::FFI::PLAN_VALUE_RAW => :raw,
21
- Leptris::XML::FFI::PLAN_VALUE_CALLBACK => :callback,
21
+ Leptris::XML::FFI::PLAN_VALUE_CALLBACK => :callback
22
22
  }.freeze
23
23
  private_constant :VALUE_KINDS
24
24
 
25
- def initialize(ptr, owner: nil, plans: nil, plan: nil, counter: nil)
25
+ def initialize(ptr, owner: nil, plans: nil, plan: nil, counter: nil,
26
+ root: nil)
26
27
  @ptr = ptr
27
28
  @owner = owner
28
29
  @plans = plans
29
30
  @plan = plan
30
31
  @counter = counter || [0]
32
+ # #1673: child views borrow their pointer from the root's
33
+ # result arena — retaining the root here (transitively) keeps
34
+ # the whole-result handle alive for as long as any borrowed
35
+ # view exists. Without it a Ruby-3.3-timed GC can free the
36
+ # root mid-read (the ride's linux/3.3 segfault).
37
+ @root = root
38
+ end
39
+
40
+ # The whole-result owner this view borrows from (self for a
41
+ # root). Retained by every borrowed child via #at.
42
+ def lifetime_root
43
+ @root || self
31
44
  end
32
45
 
33
46
  # The engine value handle — the ROOT value's is the whole-result
@@ -75,18 +88,21 @@ class Leptris::XML::PlanValue
75
88
  def int_value
76
89
  out = ::FFI::MemoryPointer.new(:int64)
77
90
  return nil unless Leptris::XML::FFI.leptris_plan_value_int(@ptr, out).zero?
91
+
78
92
  out.read_int64
79
93
  end
80
94
 
81
95
  def float_value
82
96
  out = ::FFI::MemoryPointer.new(:double)
83
97
  return nil unless Leptris::XML::FFI.leptris_plan_value_float(@ptr, out).zero?
98
+
84
99
  out.read_double
85
100
  end
86
101
 
87
102
  def bool_value
88
103
  out = ::FFI::MemoryPointer.new(:int)
89
104
  return nil unless Leptris::XML::FFI.leptris_plan_value_bool(@ptr, out).zero?
105
+
90
106
  out.read_int != 0
91
107
  end
92
108
 
@@ -114,9 +130,11 @@ class Leptris::XML::PlanValue
114
130
  @counter[0] += 1
115
131
  ptr = Leptris::XML::FFI.leptris_plan_value_at(@ptr, i)
116
132
  return nil if ptr.null?
133
+
117
134
  child_plan = child_plan_for_position(ptr)
118
135
  Leptris::XML::PlanValue.new(ptr, plans: @plans, plan: child_plan,
119
- counter: @counter)
136
+ counter: @counter,
137
+ root: lifetime_root)
120
138
  end
121
139
 
122
140
  # ELEMENT: the whole child list in one FFI crossing — parallel
@@ -136,7 +154,8 @@ class Leptris::XML::PlanValue
136
154
  tags = ::FFI::MemoryPointer.new(:uint8, n)
137
155
  handles = ::FFI::MemoryPointer.new(:pointer, n)
138
156
  needed = Leptris::XML::FFI.leptris_plan_value_children_snapshot(
139
- @ptr, blob, cap, offsets, tags, handles)
157
+ @ptr, blob, cap, offsets, tags, handles
158
+ )
140
159
  break snapshot_build(blob, offsets, tags, handles, n) if needed.zero?
141
160
 
142
161
  cap = needed
@@ -187,7 +206,7 @@ class Leptris::XML::PlanValue
187
206
  name: name,
188
207
  type_tag: type_tag,
189
208
  attributes: kwarg_attributes,
190
- children: kwarg_children,
209
+ children: kwarg_children
191
210
  }
192
211
  when :collection
193
212
  kwarg_collection_children
@@ -212,7 +231,7 @@ class Leptris::XML::PlanValue
212
231
  name: name,
213
232
  type_tag: type_tag,
214
233
  attributes: collected_attributes,
215
- children: Array.new(count) { |i| at(i).to_ruby },
234
+ children: Array.new(count) { |i| at(i).to_ruby }
216
235
  }
217
236
  when :collection
218
237
  Array.new(count) { |i| at(i).to_ruby }
@@ -225,7 +244,6 @@ class Leptris::XML::PlanValue
225
244
 
226
245
  private
227
246
 
228
-
229
247
  def kwarg_attributes
230
248
  ((@plan && @plan[:attributes]) || []).each_with_object({}) do |row, result|
231
249
  v = attribute(row[:name])
@@ -234,18 +252,19 @@ class Leptris::XML::PlanValue
234
252
  end
235
253
 
236
254
  def kwarg_children
237
- rows = ((@plan && @plan[:children]) || [])
255
+ rows = (@plan && @plan[:children]) || []
238
256
  result = {}
239
257
  rows.each_with_index do |row, i|
240
258
  value = at(i)
241
259
  next if value.nil?
260
+
242
261
  key = row[:name]
243
262
  coerced = coerce_kwarg(value, row[:kind])
244
263
  result[key] = if result.key?(key)
245
- Array(result[key]) << coerced
246
- else
247
- coerced
248
- end
264
+ Array(result[key]) << coerced
265
+ else
266
+ coerced
267
+ end
249
268
  end
250
269
  result
251
270
  end
@@ -273,14 +292,23 @@ class Leptris::XML::PlanValue
273
292
 
274
293
  def typed_string_value_for(value)
275
294
  case value.type_tag
276
- when 1 then value.int_value || (Integer(value.string_value, 10) rescue value.string_value)
277
- when 2 then value.float_value || (Float(value.string_value) rescue value.string_value)
295
+ when 1 then value.int_value || begin
296
+ Integer(value.string_value, 10)
297
+ rescue StandardError
298
+ value.string_value
299
+ end
300
+ when 2 then value.float_value || begin
301
+ Float(value.string_value)
302
+ rescue StandardError
303
+ value.string_value
304
+ end
278
305
  when 3
279
306
  v = value.bool_value
280
307
  v.nil? ? typed_bool_fallback(value.string_value) : v
281
308
  else value.string_value
282
309
  end
283
310
  end
311
+
284
312
  # contract): 1=Integer, 2=Float, 3=boolean. Executed in-pass by
285
313
  # the engine (#1269a); on its soft-fail (non-numeric source) the
286
314
  # lenient Ruby path applies, then the raw String wins.
@@ -288,9 +316,17 @@ class Leptris::XML::PlanValue
288
316
  def typed_string_value
289
317
  case type_tag
290
318
  when 1
291
- int_value || (string_value && (Integer(string_value, 10) rescue string_value))
319
+ int_value || (string_value && begin
320
+ Integer(string_value, 10)
321
+ rescue StandardError
322
+ string_value
323
+ end)
292
324
  when 2
293
- float_value || (string_value && (Float(string_value) rescue string_value))
325
+ float_value || (string_value && begin
326
+ Float(string_value)
327
+ rescue StandardError
328
+ string_value
329
+ end)
294
330
  when 3
295
331
  v = bool_value
296
332
  v.nil? ? typed_bool_fallback(string_value) : v
@@ -331,14 +367,16 @@ class Leptris::XML::PlanValue
331
367
  ptr = handles.get_pointer(i * POINTER_SIZE)
332
368
  child_plan = child_plan_for_position(ptr, name: names[i])
333
369
  children[i] = Leptris::XML::PlanValue.new(ptr, plans: @plans,
334
- plan: child_plan,
335
- counter: @counter)
370
+ plan: child_plan,
371
+ counter: @counter,
372
+ root: lifetime_root)
336
373
  end
337
374
  [names, tag_values, children]
338
375
  end
339
376
 
340
377
  def child_plan_for_position(ptr, name: nil)
341
378
  return nil unless @plan
379
+
342
380
  rows = @plan[:children] || []
343
381
  row = rows.size == 1 ? rows.first : nil
344
382
  unless row
@@ -350,6 +388,7 @@ class Leptris::XML::PlanValue
350
388
  row = rows.find { |r| r[:name] == child_name }
351
389
  end
352
390
  return nil unless row && @plans
391
+
353
392
  row[:kind] == :nested ? @plans[row[:child_plan_index]] : nil
354
393
  end
355
394
 
@@ -358,6 +397,7 @@ class Leptris::XML::PlanValue
358
397
  r[:kind] == :nested && r[:name] == child_wire_name
359
398
  end
360
399
  return nil unless row && @plans
400
+
361
401
  @plans[row[:child_plan_index]]
362
402
  end
363
403
 
@@ -376,7 +416,11 @@ class Leptris::XML::PlanValue
376
416
  def cast_attribute(value, row)
377
417
  tag = Leptris::XML::Descriptor.type_tag_code(row)
378
418
  case tag
379
- when 1 then Integer(value, 10) rescue value
419
+ when 1 then begin
420
+ Integer(value, 10)
421
+ rescue StandardError
422
+ value
423
+ end
380
424
  when 2
381
425
  begin
382
426
  Float(value)
data/lib/libleptris.so CHANGED
Binary file
data/vendor-src/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Sources vendored in this gem (recompile rights; the ruby
2
2
  variant builds them at install via extconf.rb):
3
3
 
4
- - libleptris v1.9.345
4
+ - libleptris v1.9.349
5
5
  - utf8proc v2.11.0
6
6
 
7
7
  Rebuild by hand:
@@ -1,5 +1,90 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.9.349] - 2026-10-13
4
+
5
+ ### Fixed
6
+
7
+ - **Plan arena: the window is owned by a wrapper
8
+ (leptris#1677, PR #1678).** The "multiple roots" early
9
+ return in leptris_plan_result_build neither restored the
10
+ thread-local current-arena window nor freed the arena -
11
+ the only return path that missed both. After it,
12
+ dp_cur_arena stayed pointing at the leaked arena for the
13
+ rest of the thread: every later malloc-lane mint (serialize
14
+ joins, dp_decls tables) rode the dead arena, and freeing
15
+ those interior pointers corrupted the heap - the ~50%
16
+ intermittent garbage/segfault the leptris-py suite hit
17
+ (in-process sequencing; ASAN-per-test could not see it).
18
+ The window and arena are now owned by a WRAPPER - restored
19
+ and freed unconditionally on every exit; the windowed body
20
+ touches neither. In-process regression spec: 50 rounds of
21
+ failing two-root build then walk + serialize, aborts at
22
+ round 0 pre-fix. Full suite 1994/1994.
23
+
24
+
25
+ ## [1.9.348] - 2026-10-13
26
+
27
+ ### Fixed
28
+
29
+ - **Plan walk: zero the arena-routed attribute arrays
30
+ (leptris#1673, PR #1675).** The #1670 walk arena returns
31
+ non-zeroed memory, but the walk's fixed-capacity attribute
32
+ arrays relied on calloc's NULL-fill: unbound attribute rows
33
+ left their slots unwritten, and the serialize lane's
34
+ declaration walk then read malloc-fill garbage through
35
+ attr_ns_prefixes - the segfault the 1.9.347 ride's
36
+ nested-capture specs hit (segv at 0x0 on Ruby 3.3/Linux/PGO
37
+ legs; allocation layout decided what landed in the
38
+ unwritten slots). The four arrays memset to zero at
39
+ allocation, restoring the calloc contract; dp_arena_alloc
40
+ stays raw by design. ASAN repro faulted pre-fix and passes
41
+ clean post-fix. Red-first spec pins both serialize faces on
42
+ the binding's nested-capture shape. Full suite 1992/1992.
43
+
44
+
45
+ ## [1.9.347] - 2026-10-13
46
+
47
+ ### Changed
48
+
49
+ - **Plan walk: arena-backed results + batch attribute face
50
+ (leptris#1670, PR #1671).** The ordered plan-lane walk
51
+ minted ~33K more allocations per parse than the
52
+ interpretive lane (the walk-side sibling of #408). The walk
53
+ and build lanes now mint every value struct, name/value
54
+ string, kids array, and attribute array from a root-owned
55
+ chunked bump arena (threaded via a TLS current-arena slot;
56
+ plan capture and serialization stay on malloc), and
57
+ leptris_plan_result_free releases the chunks wholesale.
58
+ Measured: 0 allocations inside the walk window on a
59
+ 5000-row walk + 10K-attribute read pass (malloc_logger).
60
+ New ABI: leptris_plan_value_attribute_count sizes the
61
+ buffers and leptris_plan_value_attributes_snapshot returns
62
+ ALL attribute names + values in ONE crossing (two-phase
63
+ capacity/retry contract) - a node with N attributes costs
64
+ O(1) crossings instead of O(N) mints. Red-first spec;
65
+ full suite 1990/1991-total green; descriptor ASAN-clean.
66
+
67
+
68
+ ## [1.9.346] - 2026-10-12
69
+
70
+ ### Fixed
71
+
72
+ - **Reserved prefixes resolve on declaration-free trees
73
+ (leptris#1664, PR #1668).** leptris_attribute_namespace_uri
74
+ answered through the attribute's ns side-cache, but only the
75
+ XML parse lane stamped it - attributes created through
76
+ leptris_element_add_attribute (the HTML/WHATWG lane) and
77
+ leptris_element_set_attribute (the mutation API) carried no
78
+ cache, so xml:lang on an HTML-parsed tree resolved to no
79
+ namespace. Both creation paths now stamp the colon-gated
80
+ side-cache (owner element + pool-owned materialized prefix)
81
+ like the parse lane's fused loop; the reserved xml binding
82
+ then answers by definition (XML Namespaces 3) on every tree
83
+ flavor. moxml's wrapper-side fallback becomes dead weight.
84
+ Red-first specs for the WHATWG-parsed and mutation-created
85
+ shapes. Full suite 1990/1990.
86
+
87
+
3
88
  ## [1.9.345] - 2026-10-12
4
89
 
5
90
  ### Fixed
@@ -3,7 +3,7 @@
3
3
  cmake_minimum_required(VERSION 3.20)
4
4
 
5
5
  project(leptris
6
- VERSION 1.9.345
6
+ VERSION 1.9.349
7
7
  DESCRIPTION "Fast XML parser and XPath evaluator in pure C"
8
8
  LANGUAGES C CXX
9
9
  )
@@ -257,6 +257,10 @@ LEPTRIS_API LeptrisPlanResult leptris_plan_walk(LeptrisDocument doc,
257
257
  LeptrisElement ctx,
258
258
  LeptrisPlan plan,
259
259
  LeptrisStatus* status);
260
+ /* Release a walk result. Pass the ROOT handle the walk returned —
261
+ * #1670 backs the whole tree with one root-owned bump arena, so
262
+ * the wholesale release is O(chunks); subtree handles share the
263
+ * arena and are dropped with it. */
260
264
  LEPTRIS_API void leptris_plan_result_free(LeptrisPlanResult result);
261
265
 
262
266
  /* #408 ask 2: build a standalone result natively from a flat op
@@ -376,6 +380,28 @@ LEPTRIS_API size_t leptris_plan_value_children_snapshot(
376
380
  LEPTRIS_API const char* leptris_plan_value_attribute(const LeptrisPlanResult v,
377
381
  const char* wire_name);
378
382
 
383
+ /* #1670: number of attributes carried on an ELEMENT value (0 for
384
+ * non-ELEMENT values and NULL). Sizes the attributes_snapshot
385
+ * buffers. */
386
+ LEPTRIS_API size_t leptris_plan_value_attribute_count(
387
+ const LeptrisPlanResult v);
388
+
389
+ /* #1670: ALL attribute names + values in ONE crossing (the
390
+ * per-name `leptris_plan_value_attribute` walk mints one
391
+ * FFI/wrapper round trip per attribute per node). ParallelArrays
392
+ * contract mirrors children_snapshot: call once with NULL blobs /
393
+ * caps 0 to size (returns the required per-blob byte capacity;
394
+ * both blobs need the same capacity), then call again with
395
+ * buffers of at least that capacity — 0 on success,
396
+ * (size_t)-1 when either buffer is still too small. Offsets are
397
+ * byte offsets into the respective blobs; entries are
398
+ * NUL-terminated. Attribute ORDER is the plan's attribute-row
399
+ * order (only bound attributes appear). NULL v returns 0. */
400
+ LEPTRIS_API size_t leptris_plan_value_attributes_snapshot(
401
+ const LeptrisPlanResult v,
402
+ char* names_blob, size_t names_cap, size_t* name_offsets,
403
+ char* values_blob, size_t values_cap, size_t* value_offsets);
404
+
379
405
  /* #1269a in-pass type execution (#1269a): for SCALAR/RAW values
380
406
  * whose producing row carried type_tag in {1=int, 2=float, 3=bool},
381
407
  * the walk parses the string once and stores typed values. The str