miller/pkg/transformers/utils
John Kerl 5f152d7669
join: exit nonzero when the left file cannot be read (#2169) (#2171)
The join verb's left-file ingest silently swallowed read errors: a
nonexistent or malformed left file produced empty (or partial) output
with exit code 0.

Two defects, one per ingest path:

* Unsorted (half-streaming) path, ingestLeftFile in
  pkg/transformers/join.go: errors from the record-reader's error
  channel were dropped ("TODO: propagate error to caller"), as were
  record-reader construction errors. All left-file read failures were
  silent.

* Sorted (-s) path, readRecord in
  pkg/transformers/utils/join_bucket_keeper.go: the error channel was
  consulted, but the record-reader goroutine sends the error and the
  end-of-stream marker on separate channels, so the select could see
  end-of-stream first and drop the error. A nonexistent left file with
  -s exited 0 about half the time (racy).

Both paths now print "mlr: <error>" to stderr and exit 1, matching how
read errors on regular (right) input files are reported. On receipt of
the end-of-stream marker, both consumers now do a final non-blocking
drain of the error channel, which is deterministic since the reader
sends any error before the marker.

Discovered while verifying #377.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 17:34:33 -04:00
..
doc.go Export library code in pkg/ (#1391) 2023-09-10 17:15:13 -04:00
join_bucket.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
join_bucket_keeper.go join: exit nonzero when the left file cannot be read (#2169) (#2171) 2026-07-06 17:34:33 -04:00
percentile_keeper.go Convert if/else-if chains to typed switch statements (staticcheck QF1003) (#2112) 2026-06-28 18:27:42 -04:00
README.md Export library code in pkg/ (#1391) 2023-09-10 17:15:13 -04:00
stats1_accumulators.go Performance and style fixes (#1981) 2026-02-18 09:19:31 -05:00
stats2_accumulators.go Convert if/else-if chains to typed switch statements (staticcheck QF1003) (#2112) 2026-06-28 18:27:42 -04:00
top_keeper.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
window_keeper.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
window_keeper_test.go Export library code in pkg/ (#1391) 2023-09-10 17:15:13 -04:00

These are data structures used by various verbs including join,stats1, and `top.