You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Depending on the relative ordering of a call to unsafeGetAttrPos to an attrset merge on the declaring attrset, the output of unsafeGetAttrPos may be different.
The attribute position is unchanged regardless of where the call to unsafeGetAttrPos is (since it's a variable in the scope, after all), and refers to the original position. Right now it looks like the position is mutated!
The critical line is // attrs.meta or { }. If the call to unsafeGetAttrPos is moved afterwards, it misbehaves and returns the position in the current file, instead of the position in the original definition of attrs.
numinit
changed the title
Unexpected unsafeGetAttrPos output depending on attrset merge order in nixpkgs
Unexpected unsafeGetAttrPos output depending on attrset merge order
May 11, 2025
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
Depending on the relative ordering of a call to unsafeGetAttrPos to an attrset merge on the declaring attrset, the output of unsafeGetAttrPos may be different.
Tested on:
Steps To Reproduce
Run https://gist.github.com/numinit/60c69b6873812c5e51c307f19cbb104b on nixpkgs master.
Expected behavior
The attribute position is unchanged regardless of where the call to unsafeGetAttrPos is (since it's a variable in the scope, after all), and refers to the original position. Right now it looks like the position is mutated!
The critical line is
// attrs.meta or { }
. If the call to unsafeGetAttrPos is moved afterwards, it misbehaves and returns the position in the current file, instead of the position in the original definition of attrs.Metadata
nix-env (Nix) 2.24.13
Additional context
Checklist
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: