Improve logging of bad checksums #7
2 changed files with 9 additions and 2 deletions
|
@ -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))
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue