Skip to content

Commit df08e1e

Browse files
committed
resolveLookupPathPath(): Fix caching of negative lookups
This avoids spamming in case the missing search path entry does not exist (#12480).
1 parent 8ac49ea commit df08e1e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/libexpr/eval.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3070,8 +3070,11 @@ std::optional<SourcePath> EvalState::resolveLookupPathPath(const LookupPath::Pat
30703070
auto i = lookupPathResolved.find(value);
30713071
if (i != lookupPathResolved.end()) return i->second;
30723072

3073-
auto finish = [&](SourcePath res) {
3074-
debug("resolved search path element '%s' to '%s'", value, res);
3073+
auto finish = [&](std::optional<SourcePath> res) {
3074+
if (res)
3075+
debug("resolved search path element '%s' to '%s'", value, *res);
3076+
else
3077+
debug("failed to resolve search path element '%s'", value);
30753078
lookupPathResolved.emplace(value, res);
30763079
return res;
30773080
};
@@ -3123,8 +3126,7 @@ std::optional<SourcePath> EvalState::resolveLookupPathPath(const LookupPath::Pat
31233126
}
31243127
}
31253128

3126-
debug("failed to resolve search path element '%s'", value);
3127-
return std::nullopt;
3129+
return finish(std::nullopt);
31283130
}
31293131

31303132

0 commit comments

Comments
 (0)