diff options
author | Ludovic Courtès <ludo@gnu.org> | 2020-03-21 23:08:04 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-03-22 00:02:23 +0100 |
commit | 4a6ec23a9780bd75a7e527bd0dfb1943347869bb (patch) | |
tree | db3317449ea9ddebc7423e6cc428229100823d15 | |
parent | 70236bae9ea7b23191a5fc452323b6fa20f31242 (diff) | |
download | gnu-guix-4a6ec23a9780bd75a7e527bd0dfb1943347869bb.tar gnu-guix-4a6ec23a9780bd75a7e527bd0dfb1943347869bb.tar.gz |
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.
-rw-r--r-- | guix/build/download.scm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/guix/build/download.scm b/guix/build/download.scm index c647d00f6b..46af149b2f 100644 --- a/guix/build/download.scm +++ b/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 |