Skip to content

segfault on conflicting packages in profile #8284

Description

@dermetfan

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    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