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

Yaml file not found when Windows username contains non-ASCII characters #2491

Closed
Forkest opened this issue Aug 14, 2016 · 6 comments
Closed
Assignees

Comments

@Forkest
Copy link

Forkest commented Aug 14, 2016

I'm encountering the same issue as described here.

Almost any stack command (except of stack --version) results in an output like this (user René here):

Could not parse 'C:\Users\Ren├®\AppData\Roaming\stack\config.yaml':
InvalidYaml (Just (YamlException "Yaml file not found: C:\\Users\\Ren\233\\AppData\\Roaming\\stack\\config.yaml"))
See http://docs.haskellstack.org/en/stable/yaml_configuration.html.

The file is recreated successfully when I delete it, so in theory it should be possible to read it too.

@Blaisorblade
Copy link
Collaborator

Blaisorblade commented Aug 14, 2016

First, thanks for the report! Can you run a failing command with -v and post the complete log?

Then, have you tried the final tip on STACK_ROOT, as a workaround?
https://stackoverflow.com/questions/34905113/how-to-change-the-default-location-of-stack-yaml-on-windows#comment57558955_34905113

EDIT: I've just found your comment confirming STACK_ROOT works, sorry for the noise.

but it worked when i set the environment varibale manually in the windows system settings

@Blaisorblade
Copy link
Collaborator

Already minimized to a bug in the Yaml library.

René/foo.yaml

true
...

testYaml.hs:

import qualified Data.Yaml as Yaml

loadYaml :: FilePath -> IO (Either Yaml.ParseException Bool)
loadYaml = Yaml.decodeFileEither

main :: IO ()
main = do
  print =<< loadYaml "René\\foo.yaml"
  return ()
$ stack runhaskell testYaml.hs
Left (InvalidYaml (Just (YamlException "Yaml file not found: Ren\233\\foo.yaml")))

What I've shown is on a fresh Win10 VM, insideGit Bash coming from Git for Windows.

@Blaisorblade
Copy link
Collaborator

Oh dear. Data.Yaml is a wrapper over a C library, but the issue is probably in its FFI code. I've filed an analysis over there. It doesn't appear fixed in later versions, but I haven't tried.

I think the easiest workaround doable inside stack is to read the file in Haskell into a bytestring and call — even if this changes the space complexity, stack.yaml files are probably usually small enough that this doesn't matter.

@Blaisorblade
Copy link
Collaborator

Re workaround: since Snoyberg is in vacation, I guess we shouldn't expect a quickfix upstream. https://twitter.com/snoyberg/status/764514619822051328

@Blaisorblade Blaisorblade self-assigned this Aug 14, 2016
Blaisorblade added a commit that referenced this issue Aug 14, 2016
@Blaisorblade
Copy link
Collaborator

It turns out I got two fixes:

Blaisorblade added a commit that referenced this issue Aug 14, 2016
Blaisorblade added a commit that referenced this issue Aug 16, 2016
@Blaisorblade
Copy link
Collaborator

@Forkest #2492 is merged so this should be fixed on master. Hence closing.

snoyberg added a commit that referenced this issue Nov 20, 2016
This has been fixed upstream, see:
snoyberg/yaml#91
snoyberg added a commit that referenced this issue Nov 20, 2016
This has been fixed upstream, see:
snoyberg/yaml#91
mgsloan added a commit that referenced this issue Nov 20, 2016
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

4 participants