>From 1c6f47211b835c38d0fd0d73b69f2c53c6990ad9 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Thu, 1 Apr 2021 21:33:14 +0200 Subject: [PATCH] setup-download: handle eof in read-chunks Handle eof objects that might be returned by `read-line' in `read-chunks', in which cases `string->number' would break, causing the errors that we sometimes observe in salmonella jobs (see #1744). Hopefully fixes #1744 --- NEWS | 4 ++++ setup-download.scm | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index eda947d2..41e849f9 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,10 @@ - Modules implementing an interface can now correctly export extra identifiers (bug reported by Martin Schneeweis, fix by "megane"). +- Tools + - Fixed a bug in chicken-install (#1744) that would cause + `Error: (string->number) bad argument type: #!eof` in some cases. + 4.13.0 - Security fixes diff --git a/setup-download.scm b/setup-download.scm index 0adc1e03..22660cd9 100644 --- a/setup-download.scm +++ b/setup-download.scm @@ -412,7 +412,9 @@ (define (read-chunks in) (let get-chunks ([data '()]) - (let ((size (string->number (read-line in) 16))) + (let* ((line (read-line in)) + (size (and (not (eof-object? line)) + (string->number line 16)))) (cond ((not size) (error "invalid response from server - please try again")) ((zero? size) -- 2.20.1