aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix-build-coordinator/agent-messaging/http/server.scm24
1 files changed, 18 insertions, 6 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm
index 7facaa3..e4f7041 100644
--- a/guix-build-coordinator/agent-messaging/http/server.scm
+++ b/guix-build-coordinator/agent-messaging/http/server.scm
@@ -564,12 +564,24 @@ port. Also, the port used can be changed by passing the --port option.\n"
(simple-format #f "error computing hash: ~A" exn))
(when (file-exists? file-name)
- ;; I've seen exceptions happen here from lzip, so try
- ;; deleting the tmp file so that it's re-uploaded.
- (log-msg logger
- 'WARN
- (simple-format #f "deleting ~A" file-name))
- (delete-file file-name))
+ (let ((md5-hash
+ (bytevector->base16-string
+ (file-hash (hash-algorithm md5) file-name)))
+ (file-bytes
+ (stat:size (stat file-name))))
+ ;; I've seen exceptions happen here from lzip, so try
+ ;; deleting the tmp file so that it's re-uploaded.
+ (log-msg logger
+ 'WARN
+ (simple-format #f "deleting ~A" file-name))
+ (delete-file file-name)
+
+ (raise-exception
+ (make-exception
+ exn
+ (make-exception-with-irritants
+ `((file-bytes . ,file-bytes)
+ (md5-hash . ,md5-hash)))))))
(raise-exception exn))
(lambda ()