logo       

Re: [GHC] #679: using ReadWriteMode in Windows corrupts files: msg#00071

lang.haskell.glasgow.bugs

Subject: Re: [GHC] #679: using ReadWriteMode in Windows corrupts files

#679: using ReadWriteMode in Windows corrupts files
-------------------------------+--------------------------------------------
Reporter: aljee@xxxxxxxx | Owner: simonmar
Type: bug | Status: new
Priority: normal | Milestone:
Component: libraries/base | Version: 6.4.1
Severity: normal | Resolution:
Keywords: | Os: Windows
Difficulty: Moderate (1 day) | Architecture: Unknown
-------------------------------+--------------------------------------------
Changes (by simonmar):

* difficulty: Unknown => Moderate (1 day)
* milestone: 6.4.2 =>

Comment:

Looking at the code, I see the problem. Seeking backwards to flush the
read buffer doesn't work on text files in Windows, at least not without
recording the file position before reading the buffer. The translation
isn't invertible; we can't fix this by counting newlines in the buffer.

I'm going to punt on this for 6.4.2. Workarounds are to use NoBuffering,
or open the file in binary mode. A quick fix would be to count newlines
in the buffer, but that's not completely correct since the newline
translation isn't invertible. Strictly speaking we have to call lseek to
get the current offset before reading a buffer, and cache this value for
later flushing.

--
Ticket URL: <http://cvs.haskell.org/trac/ghc/ticket/679>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise