CLI --help crashes with SIGBUS (Misaligned address error) #787

Open
opened 2025-04-04 04:39:32 +00:00 by ian-h-chamberlain · 1 comment

Describe the bug

All my attempts to show CLI help crash with SIGBUS.

§ nix --help 
fish: Job 1, 'nix --help' terminated by signal SIGBUS (Misaligned address error)

Steps To Reproduce

nix --help, or any subcommand also seems to reproduce (e.g. nix flake --help).

Expected behavior

Normal help output is displayed, no crash

nix --version output

nix (Lix, like Nix) 2.93.0-dev-pre20250316-2a33681
System type: aarch64-darwin
Additional system types: x86_64-darwin
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /Users/ianchamberlain/.config/nix/nix.conf:/Users/ianchamberlain/.nix-profile/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/7ric722pdx1a4asyrzqaqflqk58hq2q5-lix-2.93.0-dev-pre20250316-2a33681/share

Additional context

nix.conf

# WARNING: this file is generated from the nix.settings option in
# your Home Manager configuration at $XDG_CONFIG_HOME/nix/nix.conf.
# Do not edit it!
extra-experimental-features = repl-flake pipe-operator lix-custom-sub-commands
extra-plugin-files = /Users/ianchamberlain/.config/nix/plugins
repl-overlays = /Users/ianchamberlain/.config/nix/repl-overlays.nix

Lix-module

I am using the lix-module.overlays.default with nix-darwin plus a small custom overlay to disable some tests that kept failing:

(final: prev: {
    lix = prev.lix.override {
      aws-sdk-cpp = prev.aws-sdk-cpp.overrideAttrs (old: {
        cmakeFlags = [ "-DENABLE_TESTING=OFF" ]
          ++ old.cmakeFlags or [ ];
      });
    };
})

Lix flake inputs

├───lix: git+https://git.lix.systems/lix-project/lix.git?ref=main&rev=2a336813ad2a4d64d027830507276da32927d215
│   Last modified: 2025-03-16 18:57:11
├───lix-module: https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/621aae0f3cceaffa6d73a4fb0f89c08d338d729e.tar.gz?narHash=sha256-NG3IRvRs3u3btVCN861FqHvgOwqcNT/Oy6PBG86F5/E%3D&rev=621aae0f3cceaffa6d73a4fb0f89c08d338d729e
│   Last modified: 2025-01-29 13:54:00

lldb backtrace

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x1015378d0)
  * frame #0: 0x00000001015378d0 libc++abi.1.dylib`vtable for __cxxabiv1::__si_class_type_info + 16
    frame #1: 0x0000000100decc08 liblixutil.dylib`nix::MultiCommand::toJSON() + 216
    frame #2: 0x00000001000be368 nix`nix::NixArgs::dumpCli() + 108
    frame #3: 0x00000001000bf1a0 nix`nix::showHelp(nix::AsyncIoRoot&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>, nix::NixArgs&) + 1220
    frame #4: 0x00000001000ba398 nix`nix::mainWrapped(nix::AsyncIoRoot&, int, char**) + 6452
    frame #5: 0x00000001000c4060 nix`std::__1::__function::__func<main::$_0, std::__1::allocator<main::$_0>, void ()>::operator()() + 120
    frame #6: 0x000000010085c148 liblixmain.dylib`nix::handleExceptions(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::function<void ()>) + 392
    frame #7: 0x00000001000c06a0 nix`main + 216
    frame #8: 0x0000000187c2f154 dyld`start + 2476

Strange behavior

To check if it was just an old version bug, I tried running a new Lix version to see if its --help worked, and it did, but somehow this also seems to have resolved my original issue???

  1. Ran version 2.93.0-dev-pre20250401-5a7e9e1 with --help (it works)
  2. Ran version 2.93.0-dev-pre20250316-2a33681 with --help (previously failing, now working)

This seems very odd to me and I can't be sure what's happening, but it suggests maybe this issue is not actually as reproducible as I first thought... also perhaps upgrading will resolve it in the general case so maybe there's nothing really to do here.

## Describe the bug All my attempts to show CLI help crash with `SIGBUS`. ``` § nix --help fish: Job 1, 'nix --help' terminated by signal SIGBUS (Misaligned address error) ``` ## Steps To Reproduce `nix --help`, or any subcommand also seems to reproduce (e.g. `nix flake --help`). ## Expected behavior Normal help output is displayed, no crash ## `nix --version` output ``` nix (Lix, like Nix) 2.93.0-dev-pre20250316-2a33681 System type: aarch64-darwin Additional system types: x86_64-darwin Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /Users/ianchamberlain/.config/nix/nix.conf:/Users/ianchamberlain/.nix-profile/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/7ric722pdx1a4asyrzqaqflqk58hq2q5-lix-2.93.0-dev-pre20250316-2a33681/share ``` ## Additional context ### `nix.conf` ``` # WARNING: this file is generated from the nix.settings option in # your Home Manager configuration at $XDG_CONFIG_HOME/nix/nix.conf. # Do not edit it! extra-experimental-features = repl-flake pipe-operator lix-custom-sub-commands extra-plugin-files = /Users/ianchamberlain/.config/nix/plugins repl-overlays = /Users/ianchamberlain/.config/nix/repl-overlays.nix ``` ### Lix-module I am using the `lix-module.overlays.default` with `nix-darwin` plus a small custom overlay to disable some tests that kept failing: ```nix (final: prev: { lix = prev.lix.override { aws-sdk-cpp = prev.aws-sdk-cpp.overrideAttrs (old: { cmakeFlags = [ "-DENABLE_TESTING=OFF" ] ++ old.cmakeFlags or [ ]; }); }; }) ``` ### Lix flake inputs ``` ├───lix: git+https://git.lix.systems/lix-project/lix.git?ref=main&rev=2a336813ad2a4d64d027830507276da32927d215 │ Last modified: 2025-03-16 18:57:11 ├───lix-module: https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/621aae0f3cceaffa6d73a4fb0f89c08d338d729e.tar.gz?narHash=sha256-NG3IRvRs3u3btVCN861FqHvgOwqcNT/Oy6PBG86F5/E%3D&rev=621aae0f3cceaffa6d73a4fb0f89c08d338d729e │ Last modified: 2025-01-29 13:54:00 ``` ### lldb backtrace ``` (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x1015378d0) * frame #0: 0x00000001015378d0 libc++abi.1.dylib`vtable for __cxxabiv1::__si_class_type_info + 16 frame #1: 0x0000000100decc08 liblixutil.dylib`nix::MultiCommand::toJSON() + 216 frame #2: 0x00000001000be368 nix`nix::NixArgs::dumpCli() + 108 frame #3: 0x00000001000bf1a0 nix`nix::showHelp(nix::AsyncIoRoot&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>, nix::NixArgs&) + 1220 frame #4: 0x00000001000ba398 nix`nix::mainWrapped(nix::AsyncIoRoot&, int, char**) + 6452 frame #5: 0x00000001000c4060 nix`std::__1::__function::__func<main::$_0, std::__1::allocator<main::$_0>, void ()>::operator()() + 120 frame #6: 0x000000010085c148 liblixmain.dylib`nix::handleExceptions(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::function<void ()>) + 392 frame #7: 0x00000001000c06a0 nix`main + 216 frame #8: 0x0000000187c2f154 dyld`start + 2476 ``` ### Strange behavior To check if it was just an old version bug, I tried running a new Lix version to see if its `--help` worked, and it did, but somehow this also seems to have resolved my original issue??? 1. Ran version` 2.93.0-dev-pre20250401-5a7e9e1` with `--help` (it works) 2. Ran version `2.93.0-dev-pre20250316-2a33681` with `--help` (previously failing, now working) This seems very odd to me and I can't be sure what's happening, but it suggests maybe this issue is not actually as reproducible as I first thought... also perhaps upgrading will resolve it in the general case so maybe there's nothing really to do here.
Owner

Hi there, can you retry with the released 2.93.0 or recent HEAD? I do not have a handy macOS so it's hard for me to reproduce.

Hi there, can you retry with the released 2.93.0 or recent HEAD? I do not have a handy macOS so it's hard for me to reproduce.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#787
No description provided.