Invalid suggestions for some "ill-defined escapes" in multiline strings #1114
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
awaiting
author
awaiting
contributors
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
Feature/S3
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
ux
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/lix#1114
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
Some of the new "ill-defined escape" warnings, in multiline strings at least, provide invalid suggestions, that will change the semantics when applied.
Steps To Reproduce
nix repl''''\ ''." "(as expected), but the warning suggests to remove the''\, which is incorrect because then the space will be considered indentation and is stripped.''''\${}''"\${}", but the warning suggests to remove the''\, which is incorrect because then the dollar sign will introduce an interpolation, leading to a syntax error.Expected behavior
If there is a warning, it is actionable and the suggestion it contains is correct. More specifically:
''$.Given that escapes like
''$are accepted even if they are not needed, maybe the best way forward for now is to allow escaping space with''\, and either allow the dollar sign too or suggest''$instead?nix --versionoutputnix (Lix, like Nix) 2.95.0
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: […]
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/iyij6yf5cfnb5cbn13yqr2vnbg6w66bp-lix-2.95.0/share
Additional context
This has been reproduced on commit
64d610fddc, it just doesn't show up in thenix --versionoutput because I forgot to wire that up again in my system configuration.This issue was mentioned on Gerrit on the following CLs:
5. is already being addressed by the fixup CL. About the space, after removing the escape another warning about the indentation stripping will appear. There generally is no straightforward way to have indented strings start with spaces due to their nature (Not counting hacks like
${}, or, for that matter,''\), so I don't think that aspect can really be "fixed".