mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-18 00:45:47 +00:00
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>
6 lines
318 B
Text
6 lines
318 B
Text
color shape flag k index quantity rate
|
|
red square false 6 64 77.19910000 9.53100000
|
|
purple triangle false 7 65 80.14050000 5.82400000
|
|
yellow circle true 8 73 63.97850000 4.23700000
|
|
yellow circle true 9 87 63.50580000 8.33500000
|
|
purple square false 10 91 72.37350000 8.24300000
|