Open jakehamilton opened 2 years ago
Possible solution:
diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l
index a3a8608d9..b57a01cde 100644
--- a/src/libexpr/lexer.l
+++ b/src/libexpr/lexer.l
@@ -114,7 +114,7 @@ ANY .|\n
ID [a-zA-Z\_][a-zA-Z0-9\_\'\-]*
INT [0-9]+
FLOAT (([1-9][0-9]*\.[0-9]*)|(0?\.[0-9]+))([Ee][+-]?[0-9]+)?
-PATH_CHAR [a-zA-Z0-9\.\_\-\+]
+PATH_CHAR [a-zA-Z0-9\.\_\-\+\@]
PATH {PATH_CHAR}*(\/{PATH_CHAR}+)+\/?
PATH_SEG {PATH_CHAR}*\/
HPATH \~(\/{PATH_CHAR}+)+\/?
[dvetutnev@vulpecula:~/nix]$ outputs/out/bin/nix eval --expr '/path/p@a'
/path/p@a
Describe the bug
When calling
nix repl --arg flakePath "/some/path/to/@directory"
, the command fails with an error stating "path has a trailing slash". This seems somewhat similar to #3189 where Nix may simply be over-restrictive of what characters can allow in a path. I found this issue a few weeks ago when trying to make use offlake-utils-plus
's repl helper within a directory that had an@
in the file path. As it turned out, this problem happened withnix repl
alone.Steps To Reproduce
nix repl --arg flakePath "/some/path/to/@directory"
View Output
```bash $ nix repl --arg flakePath "/some/path/to/@directory" error: path has a trailing slash at «string»:1:15: 1| /some/path/to/@directory | ^ ```Expected behavior
Nix should allow any valid path character within paths.
I understand that there may be quite a lot to consider for changing how paths work in Nix, so I would be happy to settle with adding support for
@
at the moment. However, it would be a good thing for Nix to allow non-ascii characters in general.nix-env --version
outputAdditional context
I don't believe it's necessary to resolve this issue since the problem seems to lie within Nix itself, but here is the line in
flake-utils-plus
's repl helper that callsnix repl --arg ...
: https://github.com/gytis-ivaskevicius/flake-utils-plus/blob/2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a/lib/overlay.nix#L19