summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-07-12 11:35:56 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-07-22 17:01:13 +0200
commitf7cd59d7578739849d1b11cd18255c6682007bd4 (patch)
treed26488af49417c2daca97812a4ae9d62184f401d
parent96b4474027c9dba57bb943d84e67be402175ccc8 (diff)
downloadjustbuild-f7cd59d7578739849d1b11cd18255c6682007bd4.tar.gz
Use a fixed HashFunction in install_cas
...to calculate the empty compatible hash.
-rw-r--r--src/buildtool/main/install_cas.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/buildtool/main/install_cas.cpp b/src/buildtool/main/install_cas.cpp
index 8af7a2df..3c460200 100644
--- a/src/buildtool/main/install_cas.cpp
+++ b/src/buildtool/main/install_cas.cpp
@@ -32,7 +32,10 @@ namespace {
[[nodiscard]] auto InvalidSizeString(std::string const& size_str,
std::string const& hash,
bool has_remote) noexcept -> bool {
- static auto const kEmptyHash = HashFunction::Instance().ComputeBlobHash("");
+ // Only in compatible mode the size is checked, so an empty SHA256 hash is
+ // needed.
+ static auto const kEmptyHash =
+ HashFunction{HashFunction::JustHash::Compatible}.ComputeBlobHash("");
return Compatibility::IsCompatible() and // native mode is fine
(size_str == "0" or size_str.empty()) and // not "0" or "" is fine
kEmptyHash.HexString() != hash and // empty hash is fine