NixOS / NixOS/nix

`nix repl` fails when arg path includes an "@" symbol

Open
#7,151 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
17.7k
Forks
2k
Avg merge
1d 16h
Merged PRs (30d)
80

Description

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 of flake-utils-plus's
repl helper within a directory that had an @ in the file path. As it turned out, this problem
happened with nix repl alone.

Steps To Reproduce

  1. Run nix repl --arg flakePath "/some/path/to/@directory"
  2. You will see the following output.
View Output
$ 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 output

nix-env (Nix) 2.8.1

Additional 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 calls nix repl --arg ...: https://github.com/gytis-ivaskevicius/flake-utils-plus/blob/2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a/lib/overlay.nix#L19

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No Nix source file or test is named. Start by reproducing the nix repl --arg flakePath "/some/path/to/@directory" command and trace how nix repl parses the argument path. Done means a valid path containing @ is accepted without the trailing-slash error.

Written by the indexing model from the issue text.

Assessment

Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.