From 618f0582b49edb0a5f633c953b00fc93d03c077a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 19 Dec 2017 17:57:15 +0100 Subject: upstream: Reject bogus archive type guesses. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This would crash 'guix refresh -u' with source URLs ending in "…/v1.2.3". * guix/upstream.scm (package-update): Be stricter when determining ARCHIVE-TYPE. --- guix/upstream.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'guix/upstream.scm') diff --git a/guix/upstream.scm b/guix/upstream.scm index 0fe3308876..caaa0e44e4 100644 --- a/guix/upstream.scm +++ b/guix/upstream.scm @@ -278,7 +278,13 @@ (define* (package-update store package updaters ((archive-type) (match (and=> (package-source package) origin-uri) ((? string? uri) - (file-extension (basename uri))) + (let ((type (file-extension (basename uri)))) + ;; Sometimes we have URLs such as + ;; "https://github.com/…/tarball/v0.1", in which case + ;; we must not consider "1" as the extension. + (and (or (string-contains type "z") + (string=? type "tar")) + type))) (_ "gz"))) ((url signature-url) -- cgit v1.2.3