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

Reimplement lib.types.path.check #76977

Closed
roberth opened this issue Jan 5, 2020 · 0 comments · Fixed by #77133
Closed

Reimplement lib.types.path.check #76977

roberth opened this issue Jan 5, 2020 · 0 comments · Fixed by #77133
Labels
0.kind: bug Something is broken 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: non-nixos Running packages on non-NixOS Linux

Comments

@roberth
Copy link
Member

roberth commented Jan 5, 2020

Describe the bug

To Reproduce
Steps to reproduce the behavior:

Partiality:

nix-repl> lib.types.path.check {}
error: cannot coerce a set to a string, at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:246:42

Adding sources to store:

  1. write a module with a types.path option
  2. make the module use that path by further filtering the source
  3. use it
  4. intermediate source will be in the store (nb can be huge)

Expected behavior

No side effects, so also no exceptions.

Additional context

path.check will need to understand when string coercion is possible to avoid both exceptions and adding sources to the store.

toString implementation:
https://github.com/NixOS/nix/blob/f800d450b78091835ab7ca67847d76e75d877a24/src/libexpr/primops.cc#L1762

string coercion:
https://github.com/NixOS/nix/blob/f800d450b78091835ab7ca67847d76e75d877a24/src/libexpr/eval.cc#L1593-L1648

Metadata

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
@roberth roberth added 0.kind: bug Something is broken 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: non-nixos Running packages on non-NixOS Linux labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: non-nixos Running packages on non-NixOS Linux
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant