1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-21 09:49:36 +01:00

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.
This commit is contained in:
Sergei Zimmerman 2025-10-15 00:15:48 +03:00
parent 0c32fb3fa2
commit 69c005e805
No known key found for this signature in database

View file

@ -529,15 +529,9 @@ bool Worker::pathContentsGood(const StorePath & path)
return i->second;
printInfo("checking path '%s'...", store.printStorePath(path));
auto info = store.queryPathInfo(path);
bool res;
if (!pathExists(store.printStorePath(path)))
res = false;
else {
auto current = hashPath(
{store.getFSAccessor(), CanonPath(path.to_string())},
FileIngestionMethod::NixArchive,
info->narHash.algo)
.first;
bool res = false;
if (auto accessor = store.getFSAccessor(path, /*requireValidPath=*/false)) {
auto current = hashPath({ref{accessor}}, FileIngestionMethod::NixArchive, info->narHash.algo).first;
Hash nullHash(HashAlgorithm::SHA256);
res = info->narHash == nullHash || info->narHash == current;
}