bos: > On Wed, Aug 13, 2008 at 5:39 PM, Tim Newsham <[EMAIL PROTECTED]> wrote: > > So am I understanding you correctly that you believe this is not > > a bug? That the use Data.Binary.decodeFile function leaks a file > > descriptor and this is proper behavior? > > I think he might be saying that decodeFile is not the place for > checking this condition. I will put words in his mouth and say that > checking for EOF after a decode is the responsibility of the > application code, because the lower level cannot possibly know whether > it makes sense for there to be residual data in the ByteString. There > are plenty of file formats that consist of back-to-back concatenated > chunks of data, in which reading just one chunk does not by any means > require that a file can only contain one.
Exactly. This particular condition -- that encode should consume exactly the amount of data in the input file, and be sitting on EOF at the end -- is application dependent. That said, there's an argument to be made that the wrapper, decodeFile, could reasonable assume this is the most common case. -- Don _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
