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

Some strings can break manifest.nix #3989

Closed
evanjs opened this issue Sep 6, 2020 · 1 comment · Fixed by #4012
Closed

Some strings can break manifest.nix #3989

evanjs opened this issue Sep 6, 2020 · 1 comment · Fixed by #4012
Labels

Comments

@evanjs
Copy link
Member

evanjs commented Sep 6, 2020

The description from cargo-cache seems to be breaking manifest.nix (when installed via nix-env).

Here is the relevant string:
"Manage cargo cache (\${CARGO_HOME}, ~/.cargo/), print sizes of dirs and remove dirs selectively";

This installs fine, and presents no issues when added to systemPackages on NixOS.

Using nix-env, however, this breaks the manifest file.

Here is the manifest of a user profile with only cargo-cache installed via nix-env.

Note that the description is not escaped in the manifest:
description = "Manage cargo cache (${CARGO_HOME}, ~/.cargo/), print sizes of dirs and remove dirs selectively";

As @cleverca22 mentioned on IRC:

because it just does ${key} = "${value}";

I have seen similar weirdness with e.g. nodePackages.@angular/cli, and wanted to clarify whether this is an issue with the Nix parser or something that is being done improperly with this package.

@evanjs evanjs added the bug label Sep 6, 2020
thufschmitt added a commit to tweag/nix that referenced this issue Sep 14, 2020
Otherwise the result of the printing can't be parsed back correctly by
Nix (because the unescaped `${` will be parsed as the begining of an
anti-quotation).

Fix NixOS#3989
@thufschmitt
Copy link
Member

There's indeed an issue in the way the manifest.nix is generated as it calls nix::printValue which doesn't escape dollars. It's fairly easy to patch this (and the current behavior is certainly a bug), but it might have a bunch of side-effects as printValue is used in a lot of other places (essentially in every place where a Nix expression is dumped like in the output of nix-instantiate or nix eval), so this will be a breaking change for everything that relied on this bug.

I've opened #4012 nontheless to fix this

tazjin pushed a commit to tvlfyi/nix that referenced this issue Sep 2, 2022
Otherwise the result of the printing can't be parsed back correctly by
Nix (because the unescaped `${` will be parsed as the begining of an
anti-quotation).

Fix NixOS#3989
tazjin pushed a commit to tvlfyi/nix that referenced this issue Sep 2, 2022
Otherwise the result of the printing can't be parsed back correctly by
Nix (because the unescaped `${` will be parsed as the begining of an
anti-quotation).

Fix NixOS#3989
flokli pushed a commit to flokli/nix that referenced this issue Oct 31, 2023
Otherwise the result of the printing can't be parsed back correctly by
Nix (because the unescaped `${` will be parsed as the begining of an
anti-quotation).

Fix NixOS#3989

(cherry picked from commit 250f8a4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants