import-examples/12-15-import-formats/Ip024.off
Sources
- Pattern-mined from mikedh/trimesh, `models/comments.off` + `whitespace.off` (`tests/test_off.py`) (MIT — pattern only, no bytes copied).
Description
An OFF file's `V F E` count line carries a trailing `# comment` on the same physical line (`3 1 0 # off count line comment`). trimesh's own comment-stripping helper (`util.comment_strip`) has a self-inflicted bug on this exact construct: its chunk-rejoin logic double-emits the line preceding an inline comment, duplicating the count line in the stripped output. Every subsequent row extraction (`splits[1:vertex_count+1]` for vertices, `splits[vertex_count+1:...]` for faces) is computed from positional offsets keyed to `vertex_count`/`face_count`, so the phantom duplicate line shifts every following row by one position — a vertex row absorbs the duplicate header text as fake coordinates, and the face-row slice lands on a real vertex-coordinate row instead.
Reproducer recipe
an OFF file with `OFF` on its own line, then a count line `3 1 0 # off count line comment` (an inline `#` comment trailing the counts on the same physical line), followed by 3 vertex rows and 1 face row.
Expected kernel behavior
strip inline comments without altering line count/order; validate the declared V/F/E against rows actually present rather than trusting positional offsets blindly, and never let a comment's presence silently shift which physical line answers to which logical row.
Notes
Cross-oracle: trimesh 4.12.2 raises `ValueError: invalid literal for int() with base 10: '0.0'` from `exchange/off.py:52` (`faces = [line[1 : int(line[0]) + 1] for line in faces]`) — traced to `util.comment_strip`'s chunk-rejoin duplicating the "3 1 0" count line in its output, which shifts the vertex/face row slices by one position until a real vertex-coordinate row ("0.0 1.0 0.0") is misread as a face row and `int("0.0")` fails — verified 2026-07-17 (confirmed by inspecting `comment_strip`'s intermediate output directly). Distinct from Ip003 (header count > body rows, an honest mismatch) — here the declared counts are correct and the desync is purely a side effect of comment placement. Synonyms: "OFF comment on count line", "inline comment desyncs row offsets", "comment_strip duplication bug", "OFF lexical tokenization ambiguity". Provenance tier: bytes-only.
Expected validation
Provenance tier
bytes-only — defect not fully embodied in fixture bytes.
Byte assertions
contains(b'3 1 0 # off count line comment')
Cross-references
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes (with defect highlighting)
1OFF 23 1 0 # off count line comment 30.0 0.0 0.0 41.0 0.0 0.0 50.0 1.0 0.0 63 0 1 2