-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Tabs silently break indentation stripping #7834
Copy link
Copy link
Open
Labels
breakingChanges we can't make without breaking old expressions, changing hashes, etcChanges we can't make without breaking old expressions, changing hashes, etcbuglanguageThe Nix expression language; parser, interpreter, primops, evaluation, etcThe Nix expression language; parser, interpreter, primops, evaluation, etc
Description
Activity
Metadata
Metadata
Assignees
Labels
breakingChanges we can't make without breaking old expressions, changing hashes, etcChanges we can't make without breaking old expressions, changing hashes, etcbuglanguageThe Nix expression language; parser, interpreter, primops, evaluation, etcThe Nix expression language; parser, interpreter, primops, evaluation, etc
Describe the bug
Tabs are not supported in the indentation stripping parser. This is the right behavior in principle, but when a user does insert a tab, the behavior does not match their indentation. The right solution is to warn and let the user fix the problem. Supporting tabs is wrong, because tab width is undefined and will never be defined consistently.
Adding a warning may make
'' ''strings annoying for users who have to write strings with tabs at the start of lines, but their solution is already fragile, so they should move to explicit tabs ("\t") or put the string in a separate file.Steps To Reproduce
''string indented with tabs or a mix of spaces and tabs.Expected behavior
Warn when the first tab is encountered in the indentation stripping logic. Suggest alternatives, for both cases: user wants tabs stripped, or (less likely, current behavior) user wants to keep tabs in their string.
nix-env --versionoutputAdditional context
Removing tabs from indented strings is a hash-changing breaking change. (edit: 2024-10)
Priorities
Add 👍 to issues you find important.