Browse Source

download: Delete the output file upon failure.

This allows ENOSPC conditions to be properly reported as such rather
than as a hash mismatch due to the availability of a truncated file.

Fixes <https://bugs.gnu.org/39993>.
Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>.

* guix/build/download.scm (url-fetch): In the failure case, delete FILE.
gn-latest-20200428
Ludovic Courtès 2 years ago
parent
commit
4a6ec23a97
No known key found for this signature in database GPG Key ID: 90B11993D9AEBB5
  1. 7
      guix/build/download.scm

7
guix/build/download.scm

@ -693,6 +693,13 @@ otherwise simply ignore them."
(()
(format (current-error-port) "failed to download ~s from ~s~%"
file url)
;; Remove FILE in case we made an incomplete download, for example due
;; to ENOSPC.
(catch 'system-error
(lambda ()
(delete-file file))
(const #f))
#f))))
;;; download.scm ends here
Loading…
Cancel
Save