Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can crash with DoesNotExistError on file that exists (encoding issue) #5

Closed
joeyh opened this issue Jul 20, 2013 · 1 comment
Closed

Comments

@joeyh
Copy link
Contributor

joeyh commented Jul 20, 2013

addWatch can crash if fed a filename that contains a character that is not valid in the current locale. For exampe, in the C locale, the ü character is not valid.

This is due to the complex way that GHC handles invalid characters in filenames. It uses a FileSystemEncoding which represents those characters using special high unicode surrigate characters. Filenames that are read in (eg by getDirectoryContents) have this encoding applied. Filenames that are passed to C code have this encoding reversed, to get back to the original byte string that matches the file on disk. GHC has been doing this for a year or two (7.6 iirc).

addWatch does not apply the FileSystemEncoding when calling C code. Note that since addWatch first calls getFileStatus on the filename, the caller cannot just arrange for the encoding to be applied before calling addWatch.

I have a patch, which I'll send in a pull request. This is affecting multiple users, so I hope it can get fixed quickly.

@joeyh
Copy link
Contributor Author

joeyh commented Aug 3, 2015

My patch was applied, so this bug should probably be closed..

@joeyh joeyh closed this as completed Aug 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant