Skip to content

flake: fix string escapes - #361

Open
antonmosich wants to merge 1 commit into
serokell:masterfrom
antonmosich:escapes
Open

flake: fix string escapes#361
antonmosich wants to merge 1 commit into
serokell:masterfrom
antonmosich:escapes

Conversation

@antonmosich

Copy link
Copy Markdown

In nixlang "\." is escaped to just ".". That is, it does nothing. For there to be a "\." in the resulting string, two backslashes are needed. Lix on main now emits a warning in such cases. See the example nix repl output:

nix-repl> :p "Cargo\.lock"
Cargo.lock

nix-repl> :p "Cargo\\.lock"
Cargo\.lock

@stuebinm

Copy link
Copy Markdown
Contributor

Would be cool if this could be merged!

@blackxored

Copy link
Copy Markdown

Lix 2.95 has been released so more users are seeing this. Just an FYI.

@Luflosi

Luflosi commented Aug 8, 2026

Copy link
Copy Markdown

@antonmosich could you please rebase this PR? I'd like to use it as my flake input.

In nixlang "\." is escaped to just ".". That is, it does nothing. For
there to be a "\." in the resulting string, two backslashes are needed.
Lix on main now emits a warning in such cases. See the example nix repl
output:
	nix-repl> :p "Cargo\.lock"
	Cargo.lock

	nix-repl> :p "Cargo\\.lock"
	Cargo\.lock

PR serokell#394 removed four `\.` in regular expressions in flake.nix and replaced
them with `.`. While this is a non-breaking change in the sense that it
did not change the regular expressions, this is not the correct change.
`.` is a wildcard character in regular expressions so if you want to
match a `.` you _do_ need the \, which needs to appear twice in the nix
code to be escaped properly.
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

Successfully merging this pull request may close these issues.

4 participants