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

Fix hash error message

Wrong number of arguments was causing a format assertion.
This commit is contained in:
John Ericson 2025-09-12 08:11:53 -04:00
parent c242706319
commit c6d06ce486

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);