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

closureInfo: handle empty path set explicitly #265414

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

lheckemann
Copy link
Member

Arguably, this is a bug in Nix's structuredAttrs: without structuredAttrs, exportReferencesGraph with an empty path set would still result in information being provided. With structuredAttrs, no info is provided for an empty path set.

Nevertheless, we need to be able to build even if Nix has the bug, so work around it by checking for an empty path set and handling it explicitly.

cc @Ma27, this was broken in c8f5c30 and causes e.g. the iso build to fail: https://hydra.nixos.org/build/239890672

Description of changes

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Arguably, this is a bug in Nix's structuredAttrs: without
structuredAttrs, exportReferencesGraph with an empty path set would
still result in information being provided. With structuredAttrs, no
info is provided for an empty path set.

Nevertheless, we need to be able to build even if Nix has the bug, so
work around it by checking for an empty path set and handling it
explicitly.
Copy link
Member

@Ma27 Ma27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After chatting in private with Linus we identified the issue: my patch dropped the builder instead of a buildCommand where stdenv is sourced. This also means that there's a set -o pipefail (the problematic command is the one for $out/registration) that makes the jq|head fail loud there.

That means the the solution in here is correct. THere's one comment (and the explanation in the commit should also be updated) then this is good to go.

That said, I think the Nix behavior is correct here: closure: [] exists in .attrs.json which seems correct to me.

pkgs/build-support/closure-info.nix Show resolved Hide resolved
Copy link
Member

@Ma27 Ma27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next time, feel free to ping me earlier :)

@Ma27 Ma27 merged commit be31242 into NixOS:staging-next Nov 7, 2023
21 checks passed
@lheckemann lheckemann deleted the fix-empty-closureInfo branch November 11, 2023 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants