Lix fails to evaluate a specifically nested attribute set #845

Open
opened 2025-06-02 07:56:29 +00:00 by player131007 · 7 comments

Steps To Reproduce

  1. Try to evaluate this expression:
{
  foo.bar.baz = 1;
  foo = {
    bar.qux = 2;
  };
}
  1. Nix (2.28.3) succeeds with no errors.
  2. Lix fails with the message attribute 'bar' already defined.

Expected behavior

There should be no errors, like latest Nix.

nix --version output

nix (Lix, like Nix) 2.93.0
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/player131007/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/player131007/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/player131007/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/player131007/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/7wv7x01fjp05n40yb263wlrm0hvhzbyn-lix-2.93.0/share
## Steps To Reproduce 1. Try to evaluate this expression: ```nix { foo.bar.baz = 1; foo = { bar.qux = 2; }; } ``` 2. Nix (2.28.3) succeeds with no errors. 3. Lix fails with the message `attribute 'bar' already defined`. ## Expected behavior There should be no errors, like latest Nix. ## `nix --version` output ``` nix (Lix, like Nix) 2.93.0 System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /home/player131007/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/player131007/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/player131007/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/player131007/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/7wv7x01fjp05n40yb263wlrm0hvhzbyn-lix-2.93.0/share ```
Member

I can reproduce with Lix 2.91.1. Moreover, the order of the attributes is important. If you swap the declarations, it doesn't fail

I can reproduce with Lix 2.91.1. Moreover, the order of the attributes is important. If you swap the declarations, it doesn't fail
Member

Would be nice to have someone bisect this. Given that it was in a pretty early release, I suspect it might stem from the parser rewrite itself

Would be nice to have someone bisect this. Given that it was in a pretty early release, I suspect it might stem from the parser rewrite itself
Owner

this was present in 2.18 already, it's not a lix regression

this was present in 2.18 already, it's not a lix regression
Member

So Nix used to forbid this and then it got allowed in a later release after forking?

So Nix used to forbid this and then it got allowed in a later release after forking?
Owner

that seems to be the case. further tests show it failing all the way back to 2.3, so the bug is quite old

that seems to be the case. further tests show it failing all the way back to 2.3, so the bug is quite old

Just hit this switching from cppnix to lix, I think their bug is https://github.com/NixOS/nix/issues/11268, in which case the fix was in https://github.com/NixOS/nix/pull/11294 (landing in 2.26.)

Just hit this switching from cppnix to lix, I think their bug is https://github.com/NixOS/nix/issues/11268, in which case the fix was in https://github.com/NixOS/nix/pull/11294 (landing in 2.26.)
raito self-assigned this 2025-06-27 10:50:14 +00:00
Member

@raito I see you just self assigned, but I can also take this over within a couple of months. This issue is literally over half a decade old so a couple of months shouldn't matter too much, and more importantly, I'm currently cleaning up the test suite as part of the functional2 migration so would prefer to have functional/lang tests frozen until then

@raito I see you just self assigned, but I can also take this over within a couple of months. This issue is literally over half a decade old so a couple of months shouldn't matter too much, and more importantly, I'm currently cleaning up the test suite as part of the functional2 migration so would prefer to have functional/lang tests frozen until then
Sign in to join this conversation.
No milestone
No project
No assignees
4 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#845
No description provided.