symphorien / nix-du

Visualise which gc-roots to delete to free some space in your nix store
GNU Lesser General Public License v3.0
371 stars 5 forks source link

incorrect intermediate dependency #14

Closed raboof closed 2 years ago

raboof commented 2 years ago

I'm sorry for such a vague/hard to reproduce report, but I wanted to write this down as I'm not sure when I'll be able to dig in properly: on my system, nix-du (invoked as nix-du -s=500MB | tred | dot -Tsvg > store.svg) seems to report an incorrect intermediate dependency: it shows an edge from /run/current-system to kitty-0.25.2, and from kitty-0.25.2 to apache-maven-3.8.6.

Now sure enough /run/current-system depends on apache-maven-3.8.6:

$ nix-store -q --tree /run/current-system | grep maven
│   │   ├───/nix/store/jxapmvvk26qvn1qhyijjpk0bnc58lmbm-apache-maven-3.8.6
│   │   │   └───/nix/store/jxapmvvk26qvn1qhyijjpk0bnc58lmbm-apache-maven-3.8.6 [...]

... but not via kitty:

$ nix-store -q --tree /run/current-system | grep kitty
│   ├───/nix/store/ynz6m7xwk15vj948mavwdypsdl4834zl-kitty-0.25.2-terminfo
│   ├───/nix/store/gjhlyqf70nvlchmrnaj3wvqzpdkk66zy-kitty-0.25.2
│   │   ├───/nix/store/ynz6m7xwk15vj948mavwdypsdl4834zl-kitty-0.25.2-terminfo [...]
│   │   └───/nix/store/gjhlyqf70nvlchmrnaj3wvqzpdkk66zy-kitty-0.25.2 [...]
$ nix-store -q --tree /nix/store/gjhlyqf70nvlchmrnaj3wvqzpdkk66zy-kitty-0.25.2 | grep maven
$ nix why-depends /run/current-system /nix/store/jxapmvvk26q
vn1qhyijjpk0bnc58lmbm-apache-maven-3.8.6
/nix/store/df68cmsj3lppvfp0dnryl9fr6knmv1qy-nixos-system-rigter-22.11.git.7e52b35fe98
└───/nix/store/4m7b4afr59f3mix9yg5pj95cn1mbsmai-system-path
    └───/nix/store/807nyhnj80biawxg827zp2apbn6di7yi-idea-community-2022.2.1
        └───/nix/store/jxapmvvk26qvn1qhyijjpk0bnc58lmbm-apache-maven-3.8.6

This is 0.6.0 on nixpkgs fd54651f5ffb4a36e8463e0c327a78442b26cbe7

symphorien commented 2 years ago

the node called kitty contains all store paths which are depended upon by the same gc roots as kitty. For this reason, an edge kitty -> apache does not mean that kitty depends on apache, only that something that has the same set of dependent gc roots as kitty has such an edge. Actually the name of interior nodes is arbitrary and sometimes meaningless. So if I understand correctly, what you describe is compatible with intended behavior.

raboof commented 2 years ago

ah, clearly I misunderstood