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
stdenv: Validate meta.outputsToInstall #46834
Conversation
pkgs/stdenv/generic/check-meta.nix
Outdated
@@ -125,6 +126,20 @@ let | |||
|
|||
''; | |||
|
|||
remediate_outputs_to_unknown = attrs: let | |||
expected_outputs = (attrs.meta or {}).outputsToInstall or []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest attrs.meta.outputsToInstall or []
instead. It will only fail if attrs isn't an attrset or undefined (I think?), and the existing version will as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nix-repl> {}.bar.baz.tux or []
[ ]
whoa!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use camelCase, i.e. remediateOutputsToUnknown,
expectedOutputs, and
brokenOutputs`.
Success on x86_64-darwin (full log) Attempted: stdenv Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: stdenv Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: stdenv Partial log (click to expand)
|
What is the impact on evaluation performance? |
Success on x86_64-linux (full log) Attempted: elf-header-real, stdenv Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: elf-header-real, stdenv Partial log (click to expand)
|
Success on x86_64-darwin (full log) Attempted: elf-header-real, stdenv Partial log (click to expand)
|
on master:
on this branch:
what do you think @edolstra? |
I think at +.3s it should be only run if checkMeta is set to true:
but wouldn't mind leaving it on always if you think that is better. |
If meta.outputsToInstall is set to include absent outputs, various tools break including channel updates and nix-env. grahamc@Morbo> nix-env -i -f . -A elf-header-real installing 'elf-header' error: this derivation has bad 'meta.outputsToInstall' This patch verifies each value in meta.outputsToInstall is a valid output. It validates this condition only if checkMeta is true. grahamc@Morbo> nix-build . -A elf-header-real error: Package ‘elf-header’ in /home/grahamc/projects/nixpkgs/pkgs/development/libraries/elf-header/default.nix:36 has invalid meta.outputsToInstall, refusing to evaluate. The package elf-header has set meta.outputsToInstall to: bin however elf-header only has the outputs: out and is missing the following ouputs: - bin (use '--show-trace' to show detailed location information) Note, now the nix-env experience is decidedly worse for users who have checkMeta set to true: grahamc@Morbo> nix-env -i -f . -A elf-header-real; echo $? 0 though since this is already an issue for unfree, broken, unsupported, and insecure validity problems I'm not sure we should do something different here.
69aeaf5
to
b80c9ce
Compare
this branch:
master:
|
Backport: #46838 |
Thanks!! |
If meta.outputsToInstall is set to include absent outputs, various
tools break including channel updates and nix-env.
This patch adds a mandatory verification phase to the stdenv's meta
check to ensure the list is correct:
Note, now the nix-env experience is decidedly worse:
though since this is already an issue for unfree, broken, unsupported,
and insecure validity problems I'm not sure we should do something
different here.
One possible question is should this be moved to the checkMeta phase, and not part of every evaluation.
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)