Fix segfault in nix-repl / hydra-eval-jobs
If a "with" attribute set fails to evaluate, we have to make sure its Env record remains unchanged. Otherwise, repeated evaluation gives a segfault: nix-repl> :a with 0; { a = x; b = x; } Added 2 variables. nix-repl> a error: value is an integer while an attribute set was expected nix-repl> b Segmentation fault
This commit is contained in:
parent
28e0742966
commit
c945f015de
1 changed files with 3 additions and 3 deletions
|
@ -319,9 +319,9 @@ inline Value * EvalState::lookupVar(Env * env, const VarRef & var, bool noEval)
|
||||||
while (1) {
|
while (1) {
|
||||||
if (!env->haveWithAttrs) {
|
if (!env->haveWithAttrs) {
|
||||||
if (noEval) return 0;
|
if (noEval) return 0;
|
||||||
Expr * attrs = (Expr *) env->values[0];
|
Value * v = allocValue();
|
||||||
env->values[0] = allocValue();
|
evalAttrs(*env->up, (Expr *) env->values[0], *v);
|
||||||
evalAttrs(*env->up, attrs, *env->values[0]);
|
env->values[0] = v;
|
||||||
env->haveWithAttrs = true;
|
env->haveWithAttrs = true;
|
||||||
}
|
}
|
||||||
Bindings::iterator j = env->values[0]->attrs->find(var.name);
|
Bindings::iterator j = env->values[0]->attrs->find(var.name);
|
||||||
|
|
Loading…
Reference in a new issue