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

segfault on conflicting packages in profile #8284

Closed
dermetfan opened this issue May 2, 2023 · 1 comment · Fixed by #8346
Closed

segfault on conflicting packages in profile #8284

dermetfan opened this issue May 2, 2023 · 1 comment · Fixed by #8346
Labels

Comments

@dermetfan
Copy link
Member

Describe the bug

Nix 2.15 segfaults when one tries to install two conflicting packages into a profile:

❯ nix profile install --profile ./profile ./a ./b
fish: Job 2, 'command nix $argv' terminated by signal SIGSEGV (Address boundary error)

This only happens when you refer to the packages by file system path, even if directly given the nix store path. It works as expected and prints the appropriate error message when referred to by flake attribute path.

Steps To Reproduce

  1. Create the following flake.
  2. Run nix profile install --profile ./profile ./a ./b using Nix 2.15.

Expected behavior

❯ nix profile install --profile ./profile ./a ./b
error: An existing package already provides the following file:

         /nix/store/s5z281h1xn24wzfwmdr6699lbdc4xbdi-foo-a/foo

       This is the conflicting file from the new package:

         /nix/store/7dlry4dhs100izx3mdjvbvmzq7mkdfgj-foo-b/foo

       To remove the existing package:

         nix profile remove path:/home/dermetfan/x

       The new package can also be installed next to the existing one by assigning a different priority.
       The conflicting packages have a priority of 5.
       To prioritise the new package:

         nix profile install path:/home/dermetfan/x --priority 4

       To prioritise the existing package:

         nix profile install path:/home/dermetfan/x --priority 6

nix-env --version output

❯ nix run github:nixos/nix/2.15-maintenance -- --version
nix (Nix) 2.15.1

Additional context

This is a regression in 2.15:

❯ nix run github:nixos/nix/2.14-maintenance -- profile install --profile ./profile .#a .#b
error: files '/nix/store/s5z281h1xn24wzfwmdr6699lbdc4xbdi-foo-a/foo' and '/nix/store/7dlry4dhs100izx3mdjvbvmzq7mkdfgj-foo-b/foo' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' or type 'nix profile install --help' if using 'nix profile' to find out how to change the priority of one of the conflicting packages (0 being the highest priority)

❯ nix run github:nixos/nix/2.15-maintenance -- profile install --profile ./profile ./a ./b
fish: Job 2, 'command nix $argv' terminated by signal SIGSEGV (Address boundary error)
@dermetfan dermetfan added the bug label May 2, 2023
thufschmitt added a commit to tweag/nix that referenced this issue May 16, 2023
- If the element comes from a flake, print the full flakeref (with the
  fragment part) and not just the reference to the flake itself
- If the element doesn't come from a flake, print its store path(s)

This is a bit too verbose, but has the advantages of being correct (and
not crashing), so it's strictly better than the previous situation

Fix NixOS#8284
@thufschmitt
Copy link
Member

Thanks for raising that. I've opened #8346 to fix it, let me know if that works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants