>From 217a04c4f363b2ec37eacd8d77e464ada030d545 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Thu, 1 Apr 2021 21:11:34 +0200 Subject: [PATCH] egg-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 | 3 +++ egg-download.scm | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 18c225c5..7a2373c0 100644 --- a/NEWS +++ b/NEWS @@ -51,6 +51,9 @@ still requires PLATFORM to be set, and it can still be provided manually, but it is no longer required in the common case. +- Tools + - Fixed a bug in chicken-install (#1744) that would cause + `Error: (string->number) bad argument type: #!eof` in some cases. 5.2.0 diff --git a/egg-download.scm b/egg-download.scm index 9906ca89..dc97b376 100644 --- a/egg-download.scm +++ b/egg-download.scm @@ -208,7 +208,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