step-examples/12-13-writer-pathology/Wr042.stp
Sources
- bug-reporter language: "STEP file mixed newlines per record", "writer outputs CRLF then LF inconsistently"
Sender
Multi-pass writers where one pass appends records via a buffered text stream (LF) and a separate pass appends records via a Windows-line-ending logger (CRLF), interleaved within the same DATA section
Description
Records inside a single DATA section terminate with mixed `;\n` and `;\r\n` line endings. The spec is silent on line-ending conformance — whitespace is whitespace — but tools that line-count for diagnostics report inconsistent line numbers, content-hash caches see the file as different on each export, and editors display the file as binary. Cousin of Wr002 (HEADER vs DATA section uses different line ending) but at the per-record granularity. Bug-reporter language: "STEP file mixed newlines per record", "diff of exports is full of line-ending changes".
Reproducer recipe
a DATA section where alternate records terminate with `;\n` and `;\r\n` — for example `#1=APPLICATION_CONTEXT('automotive_design');\n` followed by `#2=PRODUCT_CONTEXT('part',#1,'mechanical');\r\n`.
Expected kernel behavior
parsers must accept (whitespace tolerance); writers should be deterministic per-file. A normaliser is the simplest fix.
Notes
**See also**: Wr002, Le028. Provenance tier: writer-side (Q5 full-corpus 2026-07-01).
Expected validation
occt=empty/empty gmsh=empty ifc=schema_n/a
Provenance tier
writer-side — defect not fully embodied in fixture bytes.
Byte assertions
contains(b';\r\n') and contains(b';\n')count(b'\r\n') >= 1 and count(b'\n') >= 5
Tier-3 assertions
load == "ok"
Cross-references
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes
1ISO-10303-21; 2/* Wr042: inconsistent line terminators: ;LF and ;CRLF mixed in DATA section */ 3/* Alternate records use LF and CRLF terminators (two-pass writer bug) */ 4/* Parser accepts both; byte-hash tools and editors see inconsistency */ 5HEADER; 6FILE_DESCRIPTION(('Wr042: mixed line endings per record'),'2;1'); 7FILE_NAME('Wr042.stp','2026-06-17T00:00:00',(''),(''),'cad-research-suite','',''); 8FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }')); 9ENDSEC; 10DATA; 11/* DEFECT: alternating ;LF and ;CRLF terminators within the DATA section */ 12#1=CARTESIAN_POINT('origin',(0.,0.,0.)); 13#2=CARTESIAN_POINT('px',(1.,0.,0.)); 14#3=CARTESIAN_POINT('py',(0.,1.,0.)); 15#4=CARTESIAN_POINT('pz',(0.,0.,1.)); 16#5=DIRECTION('xdir',(1.,0.,0.)); 17#6=DIRECTION('zdir',(0.,0.,1.)); 18#7=GEOMETRIC_CURVE_SET('mixed-eol-shape',(#1,#2,#3,#4)); 19ENDSEC; 20END-ISO-10303-21;