Sample Header Ad - 728x90

tee pipeline and pnmtools - truncated file

1 vote
1 answer
103 views
This sequence of commands works OK:
pngtopnm file.png 2> /dev/null > dump1
pnmfile  /dev/null | tee dump2 | pnmfile
stdin:	PPM raw, 1920 by 1080  maxval 255
ls -l dump2
-rw-r----- 1 cmb   49152 Sep 15 14:34 dump2
I'm not clear on what difference it makes where 'tee' is sending stdin to what gets saved in the dump file - why is 'dump2' truncated, and not identical to 'dump1'?
cmp dump
cmp: EOF on dump2 after byte 49152, in line 4
I suspect its something to do with 'pnmfile', since putting something else at the end of the pipeline seems to work OK - 'dump3' is the right size/same content as dump1, and the end of the pipe ('fmt') is doing something to the file...:
pngtopnm file.png 2> /dev/null  | tee dump3 |fmt -10 > dump4
ls -l dump
-rw-r----- 1 cmb 6220817 Sep 15 14:41 dump3
-rw-r----- 1 cmb 6224311 Sep 15 14:41 dump4
(XUbuntu 20.04, diffutils 3.7, Netpbm 10.0, coreutils 8.30)
Asked by ColinB (113 rep)
Sep 15, 2020, 02:00 PM
Last activity: Sep 15, 2020, 03:08 PM