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

Check string escaping #82

Open
sternenseemann opened this issue Mar 2, 2021 · 0 comments
Open

Check string escaping #82

sternenseemann opened this issue Mar 2, 2021 · 0 comments

Comments

@sternenseemann
Copy link

sternenseemann commented Mar 2, 2021

Nix has pretty surprising escaping behavior. There are some valid escape sequences (like \\, \n, \r, ...), but if an escape sequence doesn't exist, it just swallows the backslash silently in double quoted strings. This can lead to bugs which are hard to spot especially when using builtins.match which involves a lot of escaping usually.

It should be possible to add a warning to nixpkgs-hammering (maybe using tree-sitter to access the AST).

That problems exist currently is evidenced by NixOS/nixpkgs#114853.

(Also escaping issues in indented strings may exist, but I'm not sure on top of my head.)

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

No branches or pull requests

1 participant