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

Weird successfull parsing of invalid path literals #148

Open
sternenseemann opened this issue Oct 15, 2022 · 1 comment
Open

Weird successfull parsing of invalid path literals #148

sternenseemann opened this issue Oct 15, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@sternenseemann
Copy link

Describe the bug

Was messing around with invalid tilde starting path literals:

  • ~foo is parsed to Ident(Ident(NODE_IDENT@2..4)), the ~ seemingly disappears into nowhere. The ident is retained as oo, i.e. in tvix you can evaluate let oo = 42; in ~foo. This literal should be a parse failure.
  • ~foo/bar is parsed to Path(Path(NODE_PATH@2..8)), yielding the path oo/bar. This should also be a parse failure.

Nix forbids home path literals that don't start with ~/, so both expressions are invalid Nix. Probably significant out two chars are dropped from the literals and ~/ is also two chars long.

@sternenseemann sternenseemann added the bug Something isn't working label Oct 15, 2022
@tazjin
Copy link

tazjin commented Oct 15, 2022

I'm guessing this is a duplicate of #146. It should be possible to have rnix report these as errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants