Override verifyStore to always pass NoRepair for LocalOverlayStore.

This commit is contained in:
Ben Radford 2023-07-18 13:49:13 +01:00
parent 58085e4eff
commit d5cd74a401
No known key found for this signature in database
GPG key ID: 9DF5D4640AB888D5
3 changed files with 11 additions and 1 deletions

View file

@ -188,6 +188,13 @@ void LocalOverlayStore::deleteGCPath(const Path & path, uint64_t & bytesFreed)
}
}
bool LocalOverlayStore::verifyStore(bool checkContents, RepairFlag repair)
{
if (repair)
warn("local-overlay: store does not support --verify --repair");
return LocalStore::verifyStore(checkContents, NoRepair);
}
static RegisterStoreImplementation<LocalOverlayStore, LocalOverlayStoreConfig> regLocalOverlayStore;
}

View file

@ -112,6 +112,8 @@ private:
Callback<std::shared_ptr<const Realisation>> callback) noexcept override;
void deleteGCPath(const Path & path, uint64_t & bytesFreed) override;
bool verifyStore(bool checkContents, RepairFlag repair) override;
};
}

View file

@ -34,6 +34,7 @@ rm -v "$inputDrvFullPath"
find "$storeA" -name "*-dummy" -exec truncate -s 0 {} \;
# Verify should fail with the messages about missing input and modified dummy file
verifyOutput=$(expectStderr 1 nix-store --store "$storeB" --verify --check-contents)
verifyOutput=$(expectStderr 1 nix-store --store "$storeB" --verify --check-contents --repair)
<<<"$verifyOutput" grepQuiet "path '$inputDrvPath' disappeared, but it still has valid referrers!"
<<<"$verifyOutput" grepQuiet "path '$dummyPath' was modified! expected hash"
<<<"$verifyOutput" grepQuiet "store does not support --verify --repair"