Open
Description
I ran across this issue when working on my ftp-monitor project.
Anyway, here's a fairly minimal reimplementation of zcat, which is sufficient to demonstrate the problem:
module Main (main) where
import qualified System.IO as IO
import qualified System.IO.Streams as Streams
import System.Environment (getArgs)
main = do
(filename:_) <- getArgs
IO.withFile filename IO.ReadMode $ \h -> do
inS <- Streams.handleToInputStream h >>= Streams.gunzip
Streams.connect inS Streams.stdout
Now, if I run this on a big file, it truncates output. (Curiously, it seems to be truncating output on a newline on this and several other files).
lpsmith@church:~/src/ftp-monitor/zcat
$ wc <(cat ~/logs/cas/d5941d7e89c0d6306fc7eaa003c6389ad9e1dd7ba8b429fd0a9038344443e346.gz)
28291 161049 7303701 /dev/fd/63
$ wc <(dist/build/zcat/zcat ~/logs/cas/d5941d7e89c0d6306fc7eaa003c6389ad9e1dd7ba8b429fd0a9038344443e346.gz)
14345 313055 4402405 /dev/fd/63
$ wc <(zcat ~/logs/cas/d5941d7e89c0d6306fc7eaa003c6389ad9e1dd7ba8b429fd0a9038344443e346.gz)
454378 9861255 139101003 /dev/fd/63
$ sha256sum <(dist/build/zcat/zcat ~/logs/cas/d5941d7e89c0d6306fc7eaa003c6389ad9e1dd7ba8b429fd0a9038344443e346.gz)
ed347ba497088e0aaeb7a69d5bd694218c93a361b5683edbda73c22ff45dedd8 /dev/fd/63
$ sha256sum <(zcat ~/logs/cas/d5941d7e89c0d6306fc7eaa003c6389ad9e1dd7ba8b429fd0a9038344443e346.gz)
d5941d7e89c0d6306fc7eaa003c6389ad9e1dd7ba8b429fd0a9038344443e346 /dev/fd/63
I'll be investigating this more deeply and see if I can't track down the problem, but it would appear that the bug is with io-streams.
Metadata
Metadata
Assignees
Labels
No labels