-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Describe the bug
Firstly I think this is a different issue from the one stated here: #5587 - that one says it only allows duplicates for identical everything, i.e. identical bash binaries all of which have the same path in the nix-store.
Here, I encountered that we can have conflicting binary names even for non-identical packages but in a slightly less straight-forward setup. The conflicting binaries should have a non-current priority and then they are silently allowed to exist as the non-current priority (i.e lower priorities) don't make it to the bin/ of the current profile.
Steps To Reproduce
- Add some registry entries:
nix registry add foo0 github:NixOS/nixpkgs/<commit-hash-0>
nix registry add foo1 github:NixOS/nixpkgs/<commit-hash-1>
nix registry add foo2 github:NixOS/nixpkgs/<commit-hash-2>
nix registry add foo3 github:NixOS/nixpkgs/<commit-hash-3>
- install a pkg, say
jqfrom any one of the flake alias above:
nix profile install foo0#jq
- That'll be installed with a default priority (of
5currently). Installing another version will conflict unless you give a different priority. However I can give the exact same priority for all others as long as it's other than the currently chosen priority (5) for the pkg:
nix profile install foo1#jq --priority 6
nix profile install foo2#jq --priority 6
nix profile install foo3#jq --priority 6
- This is not great as priority 6 doesn't have a
jqthat can be unambiguously chosen. This problem will manifest much later when I decide to uninstall the currently chosen priority forjq(5). Check output of current profile'smanifest.jsonto get the index position ofjqwith priority5. Say that's position3(verify vianix profile listbut that's not going to give you the priority (as of writing this), so you need to checkmanifest.jsonanyway).
nix profile remove 3 # <<<<<<<<<<<<<< FAILS
removing 'flake:my3#legacyPackages.aarch64-linux.jq'
error: Unable to build profile. There is a conflict for the following files:
/nix/store/1gakxx73xxza318d4rypjnpxacqf5gya-jq-1.6-man/share/man/man1/jq.1.gz
/nix/store/glvdkn0gwmvhry67ic4sza18js0xbfc0-jq-1.6-man/share/man/man1/jq.1.gz
- I suppose it fails because it can't decide which of the
jqbinaries to choose for the putting into the new profile-version'sbin/dir (and correctly so)
Expected behavior
If more than 1 binary with the same name are competing for the same priority, nix profile install <...> --priority <n> should fail instead of silently passing and the problem manifesting much later at other points (such as on nix profile remove <n> above.
nix-env --version output
2.19.2
Add 👍 to issues you find important.