mirror of
https://github.com/NixOS/nix.git
synced 2025-11-21 01:39: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:
parent
0c32fb3fa2
commit
69c005e805
1 changed files with 3 additions and 9 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue