From bde5830352028db60d173f390f772579149195bf Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Sat, 26 Jul 2025 01:13:58 +0200 Subject: [PATCH] libstore/store-api: isValidPath inform the user about physical store locations Instead of showing logical Nix store paths, we show the actual physical location so that the user can stat by copy-pasting these paths. The bad thing about this change is that certain Nix porcelain only accept their logical counterparts. Change-Id: Id0eb45d1bf08a23508dfc2bb694c88155654f585 Signed-off-by: Raito Bezarius --- lix/libstore/store-api.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lix/libstore/store-api.cc b/lix/libstore/store-api.cc index 448ce7e7d..9a649901d 100644 --- a/lix/libstore/store-api.cc +++ b/lix/libstore/store-api.cc @@ -674,7 +674,9 @@ try { if (res && res->isKnownNow()) { stats.narInfoReadAverted++; if (!res->didExist()) - throw InvalidPath("path '%s' does not exist in the store", printStorePath(storePath)); + throw InvalidPath( + "path '%s' does not exist in the store", toRealPath(printStorePath(storePath)) + ); co_return ref::unsafeFromPtr(res->value); } } @@ -688,7 +690,10 @@ try { state_->pathInfoCache.upsert(std::string(storePath.to_string()), res.first == NarInfoDiskCache::oInvalid ? PathInfoCacheValue{} : PathInfoCacheValue{ .value = res.second }); if (res.first == NarInfoDiskCache::oInvalid) - throw InvalidPath("path '%s' does not exist in the store", printStorePath(storePath)); + throw InvalidPath( + "path '%s' does not exist in the store", + toRealPath(printStorePath(storePath)) + ); } co_return ref::unsafeFromPtr(res.second); } @@ -711,7 +716,9 @@ try { if (!info) { stats.narInfoMissing++; - throw InvalidPath("path '%s' does not exist in the store", printStorePath(storePath)); + throw InvalidPath( + "path '%s' does not exist in the store", toRealPath(printStorePath(storePath)) + ); } co_return ref::unsafeFromPtr(info);