diff --git a/guix/scripts/locate.scm b/guix/scripts/locate.scm index ae64f46896..92af3509bf 100644 --- a/guix/scripts/locate.scm +++ b/guix/scripts/locate.scm @@ -657,7 +657,7 @@ Locate FILE and return the list of packages that contain it.\n")) files))) (() (if (null? files) - (unless update? + (unless (or update? (assoc-ref opts 'clear?)) (leave (G_ "no files to search for~%"))) (leave (N_ "file~{ '~a'~} not found in database '~a'~%" "files~{ '~a'~} not found in database '~a'~%" diff --git a/tests/guix-locate.sh b/tests/guix-locate.sh index 43f8ba53b0..de0ea5769d 100755 --- a/tests/guix-locate.sh +++ b/tests/guix-locate.sh @@ -70,3 +70,9 @@ then $cmd_store guile | grep "$(guix build guile-bootstrap)/bin/guile" $cmd_store boot-9.scm | grep ^guile-bootstrap fi + +# The command below is an error: "no files to search for"... +guix locate && false + +# ... but this one is fine. +guix locate --clear