From 59a8099038179d2901a69b122d33d14544cd6e0d Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 8 May 2023 17:37:40 -0400 Subject: [PATCH] Fix `LocalOverlayStore::queryPathInfoUncached`, FIXME in test --- src/libstore/local-overlay-store.cc | 23 +++++++++++++---------- tests/overlay-local-store/inner.sh | 3 +-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/libstore/local-overlay-store.cc b/src/libstore/local-overlay-store.cc index 545e8d28f..bd48c12e4 100644 --- a/src/libstore/local-overlay-store.cc +++ b/src/libstore/local-overlay-store.cc @@ -33,21 +33,24 @@ void LocalOverlayStore::queryPathInfoUncached(const StorePath & path, auto callbackPtr = std::make_shared(std::move(callback)); - // If we don't have it, check lower store LocalStore::queryPathInfoUncached(path, {[this, path, callbackPtr](std::future> fut) { try { - (*callbackPtr)(fut.get()); + auto info = fut.get(); + if (info) + return (*callbackPtr)(std::move(info)); } catch (...) { - lowerStore->queryPathInfo(path, - {[path, callbackPtr](std::future> fut) { - try { - (*callbackPtr)(fut.get().get_ptr()); - } catch (...) { - callbackPtr->rethrow(); - } - }}); + return callbackPtr->rethrow(); } + // If we don't have it, check lower store + lowerStore->queryPathInfo(path, + {[path, callbackPtr](std::future> fut) { + try { + (*callbackPtr)(fut.get().get_ptr()); + } catch (...) { + return callbackPtr->rethrow(); + } + }}); }}); } diff --git a/tests/overlay-local-store/inner.sh b/tests/overlay-local-store/inner.sh index ccf24b7b0..69c6f6d0c 100755 --- a/tests/overlay-local-store/inner.sh +++ b/tests/overlay-local-store/inner.sh @@ -58,8 +58,7 @@ diff $(toRealPath "$storeA/nix/store" "$path") $(toRealPath "$TEST_ROOT/merged-s nix-store --verify-path --store "$storeA" "$path" # Verifying path in merged-store -# FIXME should succeed -expect 1 nix-store --verify-path --store "$storeB" "$path" +nix-store --verify-path --store "$storeB" "$path" ### Do a redundant add