darcs patch: Fixed typo to make it build on Windows

Wed Feb 27 02:44:26 JST 2008 Satoshi Kodama

Hi Satoshi, On Wed, Feb 27, 2008 at 03:08:38AM +0900, Satoshi Kodama wrote:
Wed Feb 27 02:44:26 JST 2008 Satoshi Kodama
* Fixed typo to make it build on Windows
Thanks for the patch! A few questions/comments:
[Fixed typo to make it build on Windows
I think this refers to deleteFile/removeFile? There seems to be more than one issue addressed in this patch, anyway.
hunk ./Distribution/Simple/Utils.hs 527 - `Exception.catch` \err -> do - exists <- fileExists targetFile + `catch` \err -> do + exists <- doesFileExist targetFile
I guess you're trying to fix a mismatch between the catch and the "ioError err"? If so, I think it would be better to change ioError to Exception.throw (or whatever the appropriate function is called).
hunk ./Distribution/Simple/Utils.hs 685 +-- lines' "foo\nbar\r\nbaz\r" == ["foo", "bar", "baz"] +lines' :: String -> [String] +lines' "" = [] +lines' s = let (l, s') = break (`elem` "\r\n") s in l : case s' of + [] -> [] + _:'\n':s'' -> lines' s'' + _:s'' -> lines' s''
This gives lines' "foo\n\n\nbar" == ["foo","","bar"] Changing the first _ to '\r' would have the meaning I think you were going for. Thanks Ian

On Wed, 2008-02-27 at 03:08 +0900, Satoshi Kodama wrote:
Wed Feb 27 02:44:26 JST 2008 Satoshi Kodama
* Fixed typo to make it build on Windows
Thanks. I've applied the changes related to the typo. I've done the bit about line endings differently. Perhaps you could check that this works for you on Windows. I assume you're using ghc-6.9 right? The code in question should only be being used with ghc-6.9 so far (though it may eventually be used with 6.8.3). So with 6.9 we call ghc-pkg describe '*' to list all the info about all of the packages. We capture the output of ghc-pkg using runInteractiveProcess. If you found that this was giving \r\n pairs then I must assume that runInteractiveProcess opens the file handles in binary mode on windows and so does not do \r\n conversion. The simplest solution therefor is to set the output handle to be in text mode so we should get \r\n conversion and thus we should be able to use the standard lines function. Duncan
participants (3)
-
Duncan Coutts
-
Ian Lynagh
-
Satoshi Kodama