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

Install of mercurial aborts with assertion failed (size_ < capacity_) in attr-set.hh #112465

Closed
tenarchits opened this issue Feb 9, 2021 · 6 comments

Comments

@tenarchits
Copy link

Describe the bug
Running nix-env --install mercurial on current Mac (M1 running x86 binaries) fails with

$ nix-env --install mercurial
warning: there are multiple derivations named 'mercurial-5.6'; using the first one
installing 'mercurial-5.6'
Assertion failed: (size_ < capacity_), function push_back, file src/libexpr/attr-set.hh, line 54.
Abort trap: 6

To Reproduce
Steps to reproduce the behavior:

  1. nix-env --install mercurial

Additional context
Several bugs reference this error message (NixOS/nix#3140, #72034). It appears that bug was fixed in Nix 2.3.4. I am running 2.3.10 and still seeing the same error message.

Notify maintainers
@edolstra

Metadata

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-darwin"`
 - host os: `Darwin 20.3.0, macOS 10.16`
 - multi-user?: `no`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.3.10`
 - channels(archit): `"nixpkgs-21.03pre268211.8e364d26848"`
 - nixpkgs: `/Users/archit/.nix-defexpr/channels/nixpkgs`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: mercurial
# a list of nixos modules affected by the problem
module:
@tenarchits
Copy link
Author

Switching to nixpkgs-20.09 solves the problem.

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-darwin"`
 - host os: `Darwin 20.3.0, macOS 10.16`
 - multi-user?: `no`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.3.10`
 - channels(archit): `"nixpkgs-20.09pre245857.41fe9fd6277, nixpkgs-20.09-darwin-20.09-darwin"`
 - nixpkgs: `/Users/archit/.nix-defexpr/channels/nixpkgs`

@tenarchits tenarchits changed the title nix-env --install aborts with assertion failed (size_ < capacity_) in attr-set.hh Install of mercurial aborts with assertion failed (size_ < capacity_) in attr-set.hh Feb 13, 2021
strager added a commit to strager/dotfiles that referenced this issue Feb 22, 2021
Work around a bug in Nix/Nixpkgs [1] which causes a crash when
installing packages.

[1] NixOS/nixpkgs#112465
@strager
Copy link
Contributor

strager commented Feb 22, 2021

I also observed this crash when installing mercurial on my non-M1 macOS machine and on Linux. Upgrading Nix didn't fix the crash, but switching to nixpkgs-20.09 did fix the crash.

@michalrudowicz
Copy link

Similar problem here, when trying to install profanity.

❯ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.15-200.fc33.x86_64, Fedora, 33 (KDE Plasma)`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.10`
 - channels(rudowicz): `"nixpkgs-21.05pre271734.aed173ff970"`
 - nixpkgs: `/home/rudowicz/.nix-defexpr/channels/nixpkgs`
❯ nix-env -i profanity
installing 'profanity-0.10.0'
nix-env: src/libexpr/attr-set.hh:54: void nix::Bindings::push_back(const nix::Attr&): Assertion `size_ < capacity_' failed.
[1]    23341 IOT instruction (core dumped)  nix-env -i profanity

@michalrudowicz
Copy link

In my case the problem is gone by switching back to the nixos-20.09 channel.

@ianthehenry
Copy link

ianthehenry commented Mar 28, 2021

As an alternative workaround that doesn't require switching channels, you can do this:

$ cat ~/.config/nixpkgs/config.nix
{
  packageOverrides = pkgs: with pkgs; {
      mercurialHack = pkgs.buildEnv {
        name = "mercurial-workaround";
        paths = [ mercurial ];
      };
    };
}

Then nix-env -iA nixpkgs.mercurialHack instead of nixpkgs.mercurial.

@NilsIrl
Copy link
Member

NilsIrl commented May 10, 2021

Fixed by NixOS/nix#4411

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

No branches or pull requests

5 participants