guix gc: Correctly handle '--delete-generations' with no arguments.
authorLudovic Courtès <ludo@gnu.org>
Wed, 10 Jul 2019 17:58:30 +0000 (19:58 +0200)
committerLudovic Courtès <ludo@gnu.org>
Thu, 11 Jul 2019 21:13:26 +0000 (23:13 +0200)
commit5c3d44303e1bb75d45334af5cf86cde723da0371
treec9827bb70c4d12c792bf24042a38ffdd36f879af
parent878a6baa4c705f4d551b60c5aa254246e0abc922
guix gc: Correctly handle '--delete-generations' with no arguments.

Previously, 'guix gc --delete-generations' would crash: the "" pattern
would be passed to 'matching-generations', which would return #f instead
of returning a list.

Reported by Raghav Gururajan <rvgn@disroot.org>
in <https://bugs.gnu.org/36466>.

* guix/ui.scm (matching-generations): Raise an error when passed an
invalid pattern.
* guix/scripts/gc.scm (delete-old-generations): Check if PATTERN is
true.
(%options): Leave ARG as-is for 'delete-generations'.
(guix-gc): Use 'assq' instead of 'assoc-ref' for 'delete-generations'.
* guix/scripts/package.scm (delete-matching-generations):
Replace (string-null? pattern) with (not pattern).  Remove 'else'
clause.
(%options): Leave ARG as-is for 'delete-generations'.
* guix/scripts/pull.scm (%options): Leave ARG as-is for
'list-generations'.
(process-query): Replace (string-null? pattern) with (not pattern).
* guix/scripts/system.scm (list-generations): Likewise, and remove
'else' clause.
(process-command): Use #f instead of "" when no pattern is given.
guix/scripts/gc.scm
guix/scripts/package.scm
guix/scripts/pull.scm
guix/scripts/system.scm
guix/ui.scm