Merge pull request 'Improve logging of bad checksums' (#7) from log-bad-checksum into main
Reviewed-on: #7
This commit is contained in:
commit
625081abff
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))
|
Digestif.SHA256.(to_raw_string (get digests.sha256))
|
||||||
|> HM.add `SHA512
|
|> HM.add `SHA512
|
||||||
Digestif.SHA512.(to_raw_string (get digests.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)
|
Logs.err (fun m -> m "Write failure for %s: %a" url KV.pp_write_error e)
|
||||||
else begin
|
else begin
|
||||||
(if sizes_match then
|
(if sizes_match then
|
||||||
Logs.err (fun m -> m "Bad checksum %s: computed %s expected %s" url
|
Logs.err (fun m -> m "Bad checksum %s:%s: computed %s expected %s" url
|
||||||
(hash_to_string hash) (Ohex.encode csum))
|
(hash_to_string hash)
|
||||||
|
(Archive_checksum.get digests hash)
|
||||||
|
(Ohex.encode csum))
|
||||||
else match body with
|
else match body with
|
||||||
| `Fixed_body (reported, actual) ->
|
| `Fixed_body (reported, actual) ->
|
||||||
Logs.err (fun m -> m "Size mismatch %s: received %a bytes expected %Lu bytes"
|
Logs.err (fun m -> m "Size mismatch %s: received %a bytes expected %Lu bytes"
|
||||||
|
|
Loading…
Reference in a new issue