unicode regression
This program now fails:
$ touch `printf "a1\243a"`
$ ls -b a*
a1\243a
$ cat q.hs
import Data.List
import System.Directory
main :: IO ()
main = do xs <- getDirectoryContents "."
let ys = filter ("a" `isPrefixOf`) xs
print ys
mapM_ removeFile ys
$ ghc --make q
$ ./q
["a1\61347a"]
q: a1�a: removeLink: does not exist (No such file or directory)
$ ls -b a*
a1\243a
$
Max says:
This program should work unmodified. The fact that it doesn't
demonstrates that I need to replace some instances of the
Foreign.C.*CString functions with their escape-handling counterparts
(withFilePath and friends). Although I fixed this in some libraries I
apparently forgot to do so in others.
Alternatively, I could change the Foreign.C functions to do the Right
Thing with escape characters. This would strictly be in violation of
the FFI spec though it would make it vastly more probable that 3rd
party libraries would work correctly with strings containing
surrogates.
Trac metadata
Trac field | Value |
---|---|
Version | 7.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | high |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |