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
Describe the bug
As of 81e7c40 a functor that doesn't take two arguments but one leads to an inifite callFunction loop. Previously this lead to a stack exhaustion and did terminate eventually.
Example expression:
leta={__functor=x: x;};ina{}
This will cause the functor that resides within the attribute set a to return itself. Since __functor requires 2 (or more?) arguments, the language then tries to call the attribute set again and that results in the __functor function to be called again... This now loops until you manually terminate it.
The recent code changes seem to have encouraged the compiler to apply tail call optimization, and thus the loop never consumes the entire stack(?).
This is not really useful on its own, but it does recover the
'infinite recursion' error message for '{ __functor = x: x; } 1', and
is more efficient in conjunction with NixOS#3718.
FixesNixOS#5515.
This is not really useful on its own, but it does recover the
'infinite recursion' error message for '{ __functor = x: x; } 1', and
is more efficient in conjunction with NixOS#3718.
FixesNixOS#5515.
Describe the bug
As of 81e7c40 a functor that doesn't take two arguments but one leads to an inifite
callFunction
loop. Previously this lead to a stack exhaustion and did terminate eventually.Example expression:
This will cause the functor that resides within the attribute set
a
to return itself. Since__functor
requires 2 (or more?) arguments, the language then tries to call the attribute set again and that results in the__functor
function to be called again... This now loops until you manually terminate it.The recent code changes seem to have encouraged the compiler to apply tail call optimization, and thus the loop never consumes the entire stack(?).
Steps To Reproduce
nix-instantiate --eval -E '({ __functor = args@{ ... }: args; }) {}'
gdb
to the process and see that it loops incallFunction
but never actually adds another stack frame.Expected behavior
I'd expect the evaluation to realize that this is an infinite loop and terminate with an error.
Stack overflow on 2.3.16
Infinite loop on 81e7c40 (and newer).
Additional context
I encountered this while writing some additional libexpr unit tests for #5377 .
The text was updated successfully, but these errors were encountered: