summaryrefslogtreecommitdiff
path: root/guix/scripts/system.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-07-10 19:58:30 +0200
committerLudovic Courtès <ludo@gnu.org>2019-07-11 23:13:26 +0200
commit5c3d44303e1bb75d45334af5cf86cde723da0371 (patch)
treec9827bb70c4d12c792bf24042a38ffdd36f879af /guix/scripts/system.scm
parent878a6baa4c705f4d551b60c5aa254246e0abc922 (diff)
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.
Diffstat (limited to 'guix/scripts/system.scm')
-rw-r--r--guix/scripts/system.scm10
1 files changed, 4 insertions, 6 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 60c1ca5c9a..67a4071684 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -614,7 +614,7 @@ PATTERN, a string. When PATTERN is #f, display all the system generations."
(cond ((not (file-exists? profile)) ; XXX: race condition
(raise (condition (&profile-not-found-error
(profile profile)))))
- ((string-null? pattern)
+ ((not pattern)
(for-each display-system-generation (profile-generations profile)))
((matching-generations pattern profile)
=>
@@ -622,9 +622,7 @@ PATTERN, a string. When PATTERN is #f, display all the system generations."
(if (null-list? numbers)
(exit 1)
(leave-on-EPIPE
- (for-each display-system-generation numbers)))))
- (else
- (leave (G_ "invalid syntax: ~a~%") pattern))))
+ (for-each display-system-generation numbers)))))))
;;;
@@ -1232,7 +1230,7 @@ argument list and OPTS is the option alist."
;; an operating system configuration file.
((list-generations)
(let ((pattern (match args
- (() "")
+ (() #f)
((pattern) pattern)
(x (leave (G_ "wrong number of arguments~%"))))))
(list-generations pattern)))
@@ -1242,7 +1240,7 @@ argument list and OPTS is the option alist."
;; operating system configuration file.
((delete-generations)
(let ((pattern (match args
- (() "")
+ (() #f)
((pattern) pattern)
(x (leave (G_ "wrong number of arguments~%"))))))
(with-store store