fix: reread a contradicted hash from disk

_stable_hashes retried through the hash cache, so both retries returned
the first reading and the file was read once before the manifest run
stopped. The retries now read the file again.
This commit is contained in:
Abdessamad Derraz committed 2026-10-21 05:07:06 +02:00
1 parent 8008439033
commit ae874534e2
2 files changed
+30 -1

No files matched your search

+3 -1
View File
@@ -3468,7 +3468,9 @@ def _stable_hashes(local_path: str, db: dict) -> dict:
if expected is None or hashes["sha1"] == expected:
_STABLE_HASHES[key] = hashes
return hashes
hashes = compute_hashes(local_path, _MANIFEST_HASHES)
# Read from disk again: the cached digest is the one in doubt, and a
# retry through the cache answered with it without a second read.
hashes = compute_hashes(local_path, _MANIFEST_HASHES, cache=False)
raise RuntimeError(
f"{local_path}: sha1 {hashes['sha1']} contradicts the database scan "
f"({expected}). Rehash the file or regenerate database.json"