Skip to content

Store path metadata has the potential to get corrupted #13384

@winterqt

Description

@winterqt

Describe the bug

In rare cases, the metadata of a store path (e.g. what drv an out path was derived from) has the potential to be incorrect.

Steps To Reproduce

  1. Check out Nixpkgs 0f64ecd19d54377664bc296469fb623c7c7470f8
  2. Create bug.nix:
let
  pkgs = import ./. { config.allowUnfree = true; };
in
{
  normal = pkgs._1password-gui;
  bad = pkgs._1password-gui.override { polkitPolicyOwners = ["winter"];};
}
$ nix-instantiate bug.nix
warning: you did not specify '--add-root'; the result might be removed by the garbage collector
/nix/store/z26zmwrfb6shlrsv61ia5slxwdj3cw7q-1password-8.10.78.drv
/nix/store/vssmdq8nw78iwwdim6l87jr1qgbkpvm2-1password-8.10.78.drv

$ nix-build bug.nix --no-out-link
/nix/store/0q4kz73yzd1w0xqph2hvc2g4z62y20kk-1password-8.10.78
/nix/store/xxx2xvymaqr448k0f7d94m38d3khmvb0-1password-8.10.78

$ nix derivation show /nix/store/0q4kz73yzd1w0xqph2hvc2g4z62y20kk-1password-8.10.78 | head
{
  "/nix/store/ny6wd0bswldsn5l151xzmgw1mj30x4c7-1password-8.10.78.drv": {
    "args": [
      "-e",
      "/nix/store/vj1c3wf9c11a0qs6p3ymfvrnsdgsdcbq-source-stdenv.sh",
      "/nix/store/shkw4qm9qcw5sc5n1k5jznc83ny02r39-default-builder.sh"
    ],
    "builder": "/nix/store/xy4jjgw87sbgwylm5kn047d9gkbhsr9x-bash-5.2p37/bin/bash",
    "env": {
      "__structuredAttrs": "",
$ nix derivation show /nix/store/xxx2xvymaqr448k0f7d94m38d3khmvb0-1password-8.10.78 | head
{
  "/nix/store/vssmdq8nw78iwwdim6l87jr1qgbkpvm2-1password-8.10.78.drv": {
    "args": [
      "-e",
      "/nix/store/vj1c3wf9c11a0qs6p3ymfvrnsdgsdcbq-source-stdenv.sh",
      "/nix/store/shkw4qm9qcw5sc5n1k5jznc83ny02r39-default-builder.sh"
    ],
    "builder": "/nix/store/xy4jjgw87sbgwylm5kn047d9gkbhsr9x-bash-5.2p37/bin/bash",
    "env": {
      "__structuredAttrs": "",

Expected behavior

For the output of nix derivation show /nix/store/0q4kz73yzd1w0xqph2hvc2g4z62y20kk-1password-8.10.78 to be /nix/store/z26zmwrfb6shlrsv61ia5slxwdj3cw7q-1password-8.10.78.drv.

Metadata

nix-env (Nix) 2.28.3

(on x86_64-linux)

Additional context

  1. If I make a small change to the expression (e.g. changing the value of polkitPolicyOwners), this issue does not occur, which implies this would likely not happen I was to nix-store --delete the affected path(s).
  2. These expressions were initially instantiated with Nix 2.24.10.

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions