-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
nix fmt crashed with a segfault when running on a fork of nixpkgs which needed some minor formatting. Unfortunately the crash was somehow not raised to the system, so there's no core dump, and I can't reproduce it.
To Reproduce
How it happened initially:
-
Check out a copy of nixpkgs at commit 858310f86722b2dc0ed6b11819264e59046925ff.
-
Change some Nix file indentation, for example by reverse-applying the following patch:
diff --git i/nixos/modules/virtualisation/nixos-containers.nix w/nixos/modules/virtualisation/nixos-containers.nix index 049950638888..3966b91b69e0 100644 --- i/nixos/modules/virtualisation/nixos-containers.nix +++ w/nixos/modules/virtualisation/nixos-containers.nix @@ -955,12 +955,12 @@ in config.nix.package ]; - enableStrictShellChecks = true; + enableStrictShellChecks = true; - environment = { - root = "${stateDirectory}/%i"; - INSTANCE = "%i"; - }; + environment = { + root = "${stateDirectory}/%i"; + INSTANCE = "%i"; + }; preStart = preStartScript dummyConfig;
-
Run
nix fmt, which runstreefmtand then crashes.
Expected behavior
treefmt should not crash.
System information
❯ treefmt --version
treefmt v2.3.1
❯ nix-info --markdown | sed "s/$USER/username/" # package metadata
- system: `"x86_64-linux"`
- host os: `Linux 6.12.48, NixOS, 25.11 (Xantusia), 25.11.20250921.554be64`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.28.5`
- channels(root): `"home-manager, nixos, nixos-hardware, nixos-stable-24.05"`
- nixpkgs: `/nix/store/yw0wijix50n0y2ii15sk8kvnwgalpq6f-source`Additional context
I tried to reproduce in a few ways, but none of them worked:
nix fmttreefmt --clear-cache && nix fmtgit checkout . && nix fmtgit checkout . && treefmt --clear-cache && nix fmttreefmt --clear-cache && git checkout . && nix fmtafter realizingtreefmt --clear-cachedoesn't just clear the cache
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working