Skip to content

Commit 69c005e

Browse files
committed
libstore: Use getFSAccessor for store object in Worker::pathContentsGood
We only care about the accessor for a single store object anyway, but the validity gets ignored. Also `pathExists(store.printStorePath(path))` is definitely incorrect since it confuses the logical location vs physical location in case of a chroot store.
1 parent 0c32fb3 commit 69c005e

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/libstore/build/worker.cc

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -529,15 +529,9 @@ bool Worker::pathContentsGood(const StorePath & path)
529529
return i->second;
530530
printInfo("checking path '%s'...", store.printStorePath(path));
531531
auto info = store.queryPathInfo(path);
532-
bool res;
533-
if (!pathExists(store.printStorePath(path)))
534-
res = false;
535-
else {
536-
auto current = hashPath(
537-
{store.getFSAccessor(), CanonPath(path.to_string())},
538-
FileIngestionMethod::NixArchive,
539-
info->narHash.algo)
540-
.first;
532+
bool res = false;
533+
if (auto accessor = store.getFSAccessor(path, /*requireValidPath=*/false)) {
534+
auto current = hashPath({ref{accessor}}, FileIngestionMethod::NixArchive, info->narHash.algo).first;
541535
Hash nullHash(HashAlgorithm::SHA256);
542536
res = info->narHash == nullHash || info->narHash == current;
543537
}

0 commit comments

Comments
 (0)