miller/test/cases/verb-split
John Kerl 9910351ca1
Copy records handed to async file-writers in tee and split verbs (#1671) (#2152)
The tee verb passed the same record pointer both to its file-output
handler (which writes asynchronously on another goroutine, and whose
buffering formats like pprint/json can hold records until close) and
downstream in the verb chain, where subsequent verbs mutate records in
place. Downstream mutations could therefore leak into the tee'd output:

  mlr tee -p cat then cat -n then nothing <<EOF
  a=1,b=2
  a=3,b=4
  a=5,b=6
  EOF

emitted "n=3,a=5,b=6" for the last tee'd record, and with pprint/json
tee formats every record picked up downstream fields.

Fix: give the file-writer its own deep copy of the record. Same fix
applied to the split verb when -v (emit downstream) is used, which
shared records with downstream the same way.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 20:17:32 -04:00
..
0001 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0002 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0003 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0004 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0005 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0006 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0007 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0008 mlr split with --folder (#1962) 2026-02-14 20:22:24 -05:00
0009 Copy records handed to async file-writers in tee and split verbs (#1671) (#2152) 2026-07-05 20:17:32 -04:00