miller/test/cases/verb-join/non-windows-left-file-not-found-sorted/experr
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

1 line
58 B
Text

mlr: open /nonesuch/nope/never: no such file or directory