1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

resolveLookupPathPath(): Fix caching of negative lookups

This avoids spamming in case the missing search path entry does not
exist (#12480).

(cherry picked from commit df08e1e204)
This commit is contained in:
Eelco Dolstra 2025-02-17 11:50:54 +01:00
parent 658392e029
commit b706642133

View file

@ -3084,8 +3084,11 @@ std::optional<std::string> EvalState::resolveLookupPathPath(const LookupPath::Pa
auto i = lookupPathResolved.find(value);
if (i != lookupPathResolved.end()) return i->second;
auto finish = [&](std::string res) {
debug("resolved search path element '%s' to '%s'", value, res);
auto finish = [&](std::optional<std::string> res) {
if (res)
debug("resolved search path element '%s' to '%s'", value, *res);
else
debug("failed to resolve search path element '%s'", value);
lookupPathResolved.emplace(value, res);
return res;
};
@ -3137,9 +3140,7 @@ std::optional<std::string> EvalState::resolveLookupPathPath(const LookupPath::Pa
}
}
debug("failed to resolve search path element '%s'", value);
return std::nullopt;
return finish(std::nullopt);
}