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

nix-build fails when "src" contains Unicode characters, i.e. "src = /tmp/créatúr" #8123

Closed
mhwombat opened this issue Jun 1, 2015 · 6 comments

Comments

@mhwombat
Copy link
Contributor

mhwombat commented Jun 1, 2015

I have a couple of accented characters in my .cabal file (but only in the description, copyright and author fields). This file works fine when I build it on a non-NixOS system with sandboxes, but on a NixOS system, the nix-build step causes an error:

error: invalid character ‘�’ in name ‘créatúr’
(use ‘--show-trace’ to show detailed location information)

And if I do nix-build --show-trace, I get:

error: while evaluating the attribute ‘src’ of the derivation ‘haskell-creatur-5.9.6’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/development/haskell-modules/generic-builder.nix":123:3:
invalid character ‘�’ in name ‘créatúr’

I think this is a bug. Although the call to nix-build is what triggers the error, if I understand correctly, nix-build doesn't know anything about cabal files, so I suspect the problem occurs elsewhere.

The files creatur.cabal, shell.nix, project.nix, and default.nix are here: https://gist.github.com/mhwombat/716cd1cc181bac64991b'

My workflow:

  1. I created default.nix.
  2. cabal2nix ./. --shell > shell.nix
  3. cabal2nix ./. > project.nix
  4. nix-shell
  5. nix-build (which produces the error)
@vcunat
Copy link
Member

vcunat commented Jun 1, 2015

In your workflow you run nix-build within a nix-shell? (Looks strange.)

@mhwombat
Copy link
Contributor Author

mhwombat commented Jun 2, 2015

I exit nix-shell before running nix-build. (I just use nix-shell to try things out). Sorry for the confusion.

@mhwombat
Copy link
Contributor Author

mhwombat commented Jun 3, 2015

I think the problem may be that the directory name itself contains accented characters ("créatúr"). Renaming the directory seems to have got me past that point.

@peti
Copy link
Member

peti commented Jun 6, 2015

nix-build can't cope with the Unicode characters in src. This is a bug in Nix, IMHO.

@peti peti changed the title error: invalid character ‘�’ in name ‘créatúr’ nix-build fails when "src" contains Unicode characters, i.e. "src = /tmp/créatúr" Jun 6, 2015
@Profpatsch
Copy link
Member

Profpatsch commented Jul 23, 2016

(triage) I supposed this hasn’t changed yet? If you create an issue in the nix repo we can close here.

@lukateras
Copy link
Member

lukateras commented Dec 23, 2017

Can't reproduce this with src anymore:

$ cat default.nix 
{ pkgs ? import <nixpkgs> {} }:

with pkgs;

stdenv.mkDerivation {
  name = "creatur";
  src = "/tmp/créatúr";
}
$ nix-build
these derivations will be built:
  /nix/store/kaz4iwkk2ng7ml42b6qy1vb64b1irn3x-creatur.drv
building path(s) ‘/nix/store/jjcvrmjk7q47iyzkgzw21ncmk53zv7bk-creatur’
unpacking sources
unpacking source archive /tmp/créatúr
do not know how to unpack source archive /tmp/créatúr
builder for ‘/nix/store/kaz4iwkk2ng7ml42b6qy1vb64b1irn3x-creatur.drv’ failed with exit code 1
error: build of ‘/nix/store/kaz4iwkk2ng7ml42b6qy1vb64b1irn3x-creatur.drv’ failed

However, name should still be Nix store compatible, and that means no Unicode characters.
That's intended, see NixOS/nix#842:

$ cat default.nix 
{ pkgs ? import <nixpkgs> {} }:

with pkgs;

stdenv.mkDerivation {
  name = "créatúr";
  src = "/tmp/créatúr";
}
$ nix-build
error: invalid character ‘�’ in name ‘créatúr’

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

5 participants