diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2026-03-26 09:18:05 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-03-29 22:32:28 +0200 |
| commit | 365dbc5b1cf31650b7a5ff7798993e226e9d98aa (patch) | |
| tree | edc302f3e609ae1f61cf2e56e052ef8d5ac92273 /guix | |
| parent | 0a8acc00599a43763697f8bfc4542ff0b34cf689 (diff) | |
import: elpa: Gracefully handle invalid ELPA version lists.
Previously version lists containing zeroes would be rejected; furthermore, #f
would be returned even though callers expect a string:
$ guix refresh emacs-counsel
guix refresh: Package version for counsel contains non numeric part.
Backtrace:
[…]
In guix/utils.scm:
925:32 5 (_ #f "0.15.1")
In unknown file:
4 (string->pointer #f #<undefined>)
[…]
guix/ui.scm:920:18: In procedure string->pointer: Wrong type argument in position 1 (expecting string): #f
* guix/import/elpa.scm (elpa-version->string): Accept zeroes in
‘elpa-version’. Raise an error instead of returning #f on failure. Clarify
error messages.
Change-Id: I1ab1d6892b434747d91e9090bb5f2f3c93f1ee92
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Merges: #7484
Diffstat (limited to 'guix')
| -rw-r--r-- | guix/import/elpa.scm | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm index 9f0a8a0adc..4f33e4f483 100644 --- a/guix/import/elpa.scm +++ b/guix/import/elpa.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch> -;;; Copyright © 2015-2018, 2020-2021, 2023 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2015-2018, 2020-2021, 2023, 2026 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com> ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net> ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net> @@ -183,18 +183,21 @@ REPO." (define (elpa-version->string elpa-version repo name) "Convert the package version as used in Emacs package files into a string." (if (pair? elpa-version) - (if (every positive? elpa-version) + (if (every (cut >= <> 0) elpa-version) (let-values (((ms rest) (match elpa-version ((ms . rest) (values ms rest))))) (fold (lambda (n s) (string-append s "." (number->string n))) (number->string ms) rest)) - (begin - (info (G_ "Package version for ~s contains non numeric part.~%") name) - (if (eq? 'gnu-devel repo) - (version-from-elpa-devel-feed name) - #f))) - #f)) + (if (eq? 'gnu-devel repo) + (version-from-elpa-devel-feed name) + (raise + (formatted-message + (G_ "invalid ELPA package version ~s for '~a'") + elpa-version name)))) + (raise (formatted-message + (G_ "invalid ELPA package version ~s for '~a' in repository '~a'") + elpa-version repo name)))) (define (package-home-page alist) "Extract the package home-page from ALIST." |
