aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/store-api.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-07-13 14:35:01 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-07-13 14:35:01 +0200
commit1d01ae816b80eaefb0996a9605d00a3031ecd4d9 (patch)
tree1c1bd15875e1efc45b0e5075b8510c3f96c9ca74 /src/libstore/store-api.cc
parent2900a441f5e2a05bc10186e37b4084acb7eca83c (diff)
Fix 'nix verify --all' on a binary cache and add a test
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r--src/libstore/store-api.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 8d46bb436..0c6788b69 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -390,7 +390,7 @@ void Store::queryPathInfo(const StorePath & storePath,
auto callbackPtr = std::make_shared<decltype(callback)>(std::move(callback));
queryPathInfoUncached(storePath,
- {[this, storePath{printStorePath(storePath)}, hashPart, callbackPtr](std::future<std::shared_ptr<const ValidPathInfo>> fut) {
+ {[this, storePathS{printStorePath(storePath)}, hashPart, callbackPtr](std::future<std::shared_ptr<const ValidPathInfo>> fut) {
try {
auto info = fut.get();
@@ -403,9 +403,15 @@ void Store::queryPathInfo(const StorePath & storePath,
state_->pathInfoCache.upsert(hashPart, PathInfoCacheValue { .value = info });
}
- if (!info || info->path != parseStorePath(storePath)) {
+ auto storePath = parseStorePath(storePathS);
+
+ if (!info
+ || info->path.hashPart() != storePath.hashPart()
+ || (storePath.name() != MissingName && info->path.name() != storePath.name())
+ )
+ {
stats.narInfoMissing++;
- throw InvalidPath("path '%s' is not valid", storePath);
+ throw InvalidPath("path '%s' is not valid", storePathS);
}
(*callbackPtr)(ref<const ValidPathInfo>(info));