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

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

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

Comments

@Forkest
Copy link

@Forkest 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 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

@Blaisorblade Blaisorblade commented Aug 14, 2016

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

@Blaisorblade Blaisorblade commented Aug 14, 2016

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

@Blaisorblade Blaisorblade commented Aug 14, 2016

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

@Blaisorblade Blaisorblade commented Aug 14, 2016

It turns out I got two fixes:

  • snoyberg/yaml#91, under review externally (even though Snoyberg is on vacation he reacted to my bug report).
  • a workaround through #2492 (that somehow is failing on Windows though, I didn't check because I was working on the other fix, investigating now O_O).
Blaisorblade added a commit that referenced this issue Aug 14, 2016
Blaisorblade added a commit that referenced this issue Aug 16, 2016
…intl-bug

Workaround #2491 at all call sites
@Blaisorblade
Copy link
Collaborator

@Blaisorblade Blaisorblade commented Aug 17, 2016

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

@snoyberg snoyberg removed the in progress label Aug 17, 2016
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
…xtra

Drop Data.Yaml.Extra #2491
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants