Opened 9 years ago

Closed 9 years ago

#5221 closed bug (worksforme)

unicode regression

Reported by: igloo Owned by: batterseapower
Priority: high Milestone: 7.2.1
Component: Compiler Version: 7.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

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.

Change History (2)

comment:1 Changed 9 years ago by batterseapower

Status: newinfoneeded

I rechecked this and your example program does in fact work with HEAD. The necessary changes to the unix package were already pushed.

Have I missed something? Are you sure this build has all the latest libraries too?

comment:2 Changed 9 years ago by igloo

Resolution: worksforme
Status: infoneededclosed

Hmm, works for me too now. I must have not pulled everything properly. Sorry for the noise.

Note: See TracTickets for help on using tickets.