Improve logging of bad checksums

We now print the computed hash \o/
This commit is contained in:
Reynir Björnsson 2024-10-17 17:26:00 +02:00
parent 1241753a8c
commit 5938a60289
2 changed files with 9 additions and 2 deletions

View file

@ -62,3 +62,8 @@ let digests_to_hm digests =
Digestif.SHA256.(to_raw_string (get digests.sha256))
|> HM.add `SHA512
Digestif.SHA512.(to_raw_string (get digests.sha512))
let get digests = function
| `MD5 -> Digestif.MD5.(to_raw_string (get digests.md5))
| `SHA256 -> Digestif.SHA256.(to_raw_string (get digests.sha256))
| `SHA512 -> Digestif.SHA512.(to_raw_string (get digests.sha512))

View file

@ -480,8 +480,10 @@ module Make
Logs.err (fun m -> m "Write failure for %s: %a" url KV.pp_write_error e)
else begin
(if sizes_match then
Logs.err (fun m -> m "Bad checksum %s: computed %s expected %s" url
(hash_to_string hash) (Ohex.encode csum))
Logs.err (fun m -> m "Bad checksum %s:%s: computed %s expected %s" url
(hash_to_string hash)
(Archive_checksum.get digests hash)
(Ohex.encode csum))
else match body with
| `Fixed_body (reported, actual) ->
Logs.err (fun m -> m "Size mismatch %s: received %a bytes expected %Lu bytes"