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

Project whose path contains non-ASCII characters fails to build on Linux #4443

Closed
mhwombat opened this issue Dec 13, 2018 · 10 comments
Closed

Comments

@mhwombat
Copy link

General summary/comments (optional)

In latest Stack version, a project won't build if its pathname contains non-ASCII characters.

Steps to reproduce

  1. stack new dúmmy # Note the accent on the ú
  2. cd dúmmy/
  3. stack build

Expected

I expect it to build

Actual

The build fails.

If you do the same steps, but using the project name "dummy" (no accent), the build succeeds.

$ stack build
Building all executables for `dúmmy' once. After a successful build of all of them, only specified executables will be rebuilt.
dúmmy-0.1.0.0: configure (lib + exe)
<stdout>: commitBuffer: invalid argument (invalid character)
Configuring d

--  While building package d\250mmy-0.1.0.0 using:
      /home/amy/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.4 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1 configure --with-ghc=/nix/store/vrdzir6ql35x1an44ln0vir3a3pra75f-ghc-8.4.4/bin/ghc --with-ghc-pkg=/nix/store/vrdzir6ql35x1an44ln0vir3a3pra75f-ghc-8.4.4/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/amy/.stack/snapshots/x86_64-linux-nix/lts-12.22/8.4.4/pkgdb --package-db=/home/amy/dúmmy/.stack-work/install/x86_64-linux-nix/lts-12.22/8.4.4/pkgdb --libdir=/home/amy/dúmmy/.stack-work/install/x86_64-linux-nix/lts-12.22/8.4.4/lib --bindir=/home/amy/dúmmy/.stack-work/install/x86_64-linux-nix/lts-12.22/8.4.4/bin --datadir=/home/amy/dúmmy/.stack-work/install/x86_64-linux-nix/lts-12.22/8.4.4/share --libexecdir=/home/amy/dúmmy/.stack-work/install/x86_64-linux-nix/lts-12.22/8.4.4/libexec --sysconfdir=/home/amy/dúmmy/.stack-work/install/x86_64-linux-nix/lts-12.22/8.4.4/etc --docdir=/home/amy/dúmmy/.stack-work/install/x86_64-linux-nix/lts-12.22/8.4.4/doc/dúmmy-0.1.0.0 --htmldir=/home/amy/dúmmy/.stack-work/install/x86_64-linux-nix/lts-12.22/8.4.4/doc/dúmmy-0.1.0.0 --haddockdir=/home/amy/dúmmy/.stack-work/install/x86_64-linux-nix/lts-12.22/8.4.4/doc/dúmmy-0.1.0.0 --dependency=base=base-4.11.1.0 --extra-include-dirs=/nix/store/3zal9zfqb41fsbmwl5ba7sxh3h2ngvxi-git-2.18.1/include --extra-include-dirs=/nix/store/ipba8r4418ls0j55p5y5gi4zmg2kna5n-gmp-6.1.2-dev/include --extra-include-dirs=/nix/store/iw94llkj05wgaz268mlzvgx8jkbi1ss0-gcc-wrapper-7.3.0/include --extra-include-dirs=/nix/store/vrdzir6ql35x1an44ln0vir3a3pra75f-ghc-8.4.4/include --extra-lib-dirs=/nix/store/3zal9zfqb41fsbmwl5ba7sxh3h2ngvxi-git-2.18.1/lib --extra-lib-dirs=/nix/store/iw94llkj05wgaz268mlzvgx8jkbi1ss0-gcc-wrapper-7.3.0/lib --extra-lib-dirs=/nix/store/rxaclc3vhxbzgfllv7601i85z854h48a-gmp-6.1.2/lib --extra-lib-dirs=/nix/store/vrdzir6ql35x1an44ln0vir3a3pra75f-ghc-8.4.4/lib --enable-tests --enable-benchmarks
    Process exited with code: ExitFailure 1

Output in verbose mode is shown in gist.

Stack version

$ stack --version
Version 1.9.3, Git revision 40cf7b37526b86d1676da82167ea8758a854953b (6211 commits) x86_64 hpack-0.31.1

Method of installation

This is on a NixOS, installed using NixOS package repo.

@mhwombat
Copy link
Author

Forgot to add:

$ locale
LANG=en_IE.UTF-8
LC_CTYPE="en_IE.UTF-8"
LC_NUMERIC="en_IE.UTF-8"
LC_TIME="en_IE.UTF-8"
LC_COLLATE="en_IE.UTF-8"
LC_MONETARY="en_IE.UTF-8"
LC_MESSAGES="en_IE.UTF-8"
LC_PAPER="en_IE.UTF-8"
LC_NAME="en_IE.UTF-8"
LC_ADDRESS="en_IE.UTF-8"
LC_TELEPHONE="en_IE.UTF-8"
LC_MEASUREMENT="en_IE.UTF-8"
LC_IDENTIFICATION="en_IE.UTF-8"
LC_ALL=

@qrilka
Copy link
Contributor

qrilka commented Dec 13, 2018

BTW @mhwombat did you try impure Nix mode in Stack with --no-nix-pure? By default nix mode is run in pure nix shell and that makes your locale listing inapplicable though as of #4294 en_US.UTF-8 should be used as a default.
Also running Stack in verbose mode could help a lot.

@mhwombat
Copy link
Author

mhwombat commented Dec 13, 2018

That gist I linked to includes the output when running in verbose mode.

I forgot to say that I tried --no-nix-pure, and got a similar message. Here's that gist with --no-nix-pure.

@mhwombat
Copy link
Author

mhwombat commented Dec 13, 2018

I was able to duplicate the problem on Debian. Here's the gist.

EDIT: Just to clarify, I don't have Nix installed on the Debian machine, so I don't think this problem is Nix-specific.

@dbaynard
Copy link
Contributor

@mhwombat Thanks for the report. I've just had a flick through the related issues; would you please check whether this is still an issue for you with stack nightly?

Meanwhile, I'll try to repro with an integration test based on the one in #4294 (unless you want to do that?).

@mhwombat
Copy link
Author

I'll try both of those and let you know.

Incidentally, this was working fine a few weeks ago. I have a hunch that it might be a cabal issue rather than a Stack issue. I'll try to test that theory as well.

@mhwombat
Copy link
Author

It seems my hunch was correct; it's not a Stack issue per se. What's happening here is that cabal build automatically generates a module called Paths__projectname_, and that's what causes the problem.

$ cabal build
Config file path source is default config file.
Config file /home/amy/.cabal/config not found.
Writing default configuration to /home/amy/.cabal/config
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Resolving dependencies...
Configuring dúmmy-0.1.0.0...
Preprocessing library for dúmmy-0.1.0.0..
Building library for dúmmy-0.1.0.0..
ghc: fd:23: hGetContents: invalid argument (invalid byte sequence)

In file included from <command-line>:7:0: error: 

dist/build/autogen/Paths_dúmmy.hs:4:15: error:
    lexical error (UTF-8 decoding error)
  |
4 | module Paths_d�mmy (
  |

@dbaynard
Copy link
Contributor

@mhwombat Thanks for investigating — and please do comment here if you find a suitable workaround.

@qrilka
Copy link
Contributor

qrilka commented Dec 16, 2018

BTW @mhwombat did you open a Cabal issue about this?

@mhwombat
Copy link
Author

As it turns out, there is already a Cabal issue about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants