Skip to content

Commit a13149e

Browse files
authored
Merge pull request #12486 from NixOS/mergify/bp/2.26-maintenance/pr-12481
resolveLookupPathPath(): Fix caching of negative lookups (backport #12481)
2 parents bcbfdc1 + 640ce50 commit a13149e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/libexpr/eval-settings.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Strings EvalSettings::getDefaultNixPath()
5757
{
5858
Strings res;
5959
auto add = [&](const Path & p, const std::string & s = std::string()) {
60-
if (pathAccessible(p)) {
60+
if (std::filesystem::exists(p)) {
6161
if (s.empty()) {
6262
res.push_back(p);
6363
} else {

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)