1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-14 21:11:04 +01:00

Merge pull request #14240 from NixOS/2.31-maintenance-backport-13975

Fix hash error message
This commit is contained in:
John Ericson 2025-10-13 18:07:16 -04:00 committed by GitHub
commit dc87ed5eab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -135,7 +135,8 @@ static Hash parseLowLevel(std::string_view rest, HashAlgorithm algo, DecodeNameP
e.addTrace({}, "While decoding hash '%s'", rest);
}
if (d.size() != res.hashSize)
throw BadHash("invalid %s hash '%s' %d %d", pair.encodingName, rest);
throw BadHash(
"invalid %s hash '%s', length %d != expected length %d", pair.encodingName, rest, d.size(), res.hashSize);
assert(res.hashSize);
memcpy(res.hash, d.data(), res.hashSize);