I've just been trying out Darcs (head) with GHC 7.2, and spent a while
tracking down why some of the tests fail: I thought it worth documenting
it here to save others the effort...
The tests that fail are those that use non-ASCII filenames. For example,
the issue1763 test creates a file with a filename that contains
non-ASCII characters, then tries to use "darcs rec -l" to add it -- but
darcs compiled with GHC 7.2 ignores it (or, rather, treats it as boring).
It's caused by a behaviour change in the GHC standard libraries. In GHC
< 7.2, System.Directory.getDirectoryContents returned filenames as
Strings where each character represents a byte returned by the operating
system. In GHC 7.2, getDirectoryContents attempts to decode the filename
using the current locale, and returns the decoded version. This sort of
does the right thing when the current locale's encoding matches the
filesystem encoding (although it cannot possibly know whether that's the
case, and in any case it returns different results from previous
versions, so Darcs will need to be adapted to not do any decoding
itself). However, when the locale *doesn't* match the filename system --
e.g. when LANG=C in the tests -- it maps characters it doesn't recognise
to private-use code points.
For example (trimmed a bit):
$ ls
_darcs foo xá
$ LANG=en_GB.UTF-8 ghci-7.0.4
GHCi, version 7.0.4: http://www.haskell.org/ghc/ :? for help
Prelude System.Directory> getDirectoryContents "."
["foo","x\195\161","..","_darcs","."]
$ LANG=C ghci-7.0.4
GHCi, version 7.0.4: http://www.haskell.org/ghc/ :? for help
Prelude System.Directory> getDirectoryContents "."
["foo","x\195\161","..","_darcs","."]
$ LANG=en_GB.UTF-8 ghci-7.2.1
GHCi, version 7.2.1: http://www.haskell.org/ghc/ :? for help
Prelude System.Directory> getDirectoryContents "."
["foo","x\225","..","_darcs","."]
$ LANG=C ghci-7.2.1
GHCi, version 7.2.1: http://www.haskell.org/ghc/ :? for help
Prelude System.Directory> getDirectoryContents "."
["foo","x\61379\61345","..","_darcs","."]
It seems to me that this makes it awkward to write Haskell programs that
manipulate filenames in a predictable way; any thoughts?
|