diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2023-11-15 18:12:24 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2023-11-15 18:29:37 +0100 |
| commit | 69d9a020949c77c77b449c1faf04397b95eef5b7 (patch) | |
| tree | 623a437efa4b347d64973f0ca875d4396ee308f9 | |
| parent | 3fe31e37a9c92a413530cb86a58921af6b407706 (diff) | |
locate: Accept ‘--clear’ without additional arguments.
Fixes a bug whereby ‘guix locate --clear’ would end with the “no files
to search for” error.
Fixes <https://issues.guix.gnu.org/66799>.
* guix/scripts/locate.scm (guix-locate): Do not emit “no files to search
for” error when 'clear? is set in OPTS.
* tests/guix-locate.sh: Test it.
Reported-by: Maciej Kalandyk <m.kalandyk@outlook.com>
Change-Id: Ib8fa125c18481d7f5408bd89df9503713527641d
| -rw-r--r-- | guix/scripts/locate.scm | 2 | ||||
| -rwxr-xr-x | tests/guix-locate.sh | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/guix/scripts/locate.scm b/guix/scripts/locate.scm index ae64f468963..92af3509bf0 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")) | |||
| 657 | files))) | 657 | files))) |
| 658 | (() | 658 | (() |
| 659 | (if (null? files) | 659 | (if (null? files) |
| 660 | (unless update? | 660 | (unless (or update? (assoc-ref opts 'clear?)) |
| 661 | (leave (G_ "no files to search for~%"))) | 661 | (leave (G_ "no files to search for~%"))) |
| 662 | (leave (N_ "file~{ '~a'~} not found in database '~a'~%" | 662 | (leave (N_ "file~{ '~a'~} not found in database '~a'~%" |
| 663 | "files~{ '~a'~} not found in database '~a'~%" | 663 | "files~{ '~a'~} not found in database '~a'~%" |
diff --git a/tests/guix-locate.sh b/tests/guix-locate.sh index 43f8ba53b0c..de0ea5769db 100755 --- a/tests/guix-locate.sh +++ b/tests/guix-locate.sh | |||
| @@ -70,3 +70,9 @@ then | |||
| 70 | $cmd_store guile | grep "$(guix build guile-bootstrap)/bin/guile" | 70 | $cmd_store guile | grep "$(guix build guile-bootstrap)/bin/guile" |
| 71 | $cmd_store boot-9.scm | grep ^guile-bootstrap | 71 | $cmd_store boot-9.scm | grep ^guile-bootstrap |
| 72 | fi | 72 | fi |
| 73 | |||
| 74 | # The command below is an error: "no files to search for"... | ||
| 75 | guix locate && false | ||
| 76 | |||
| 77 | # ... but this one is fine. | ||
| 78 | guix locate --clear | ||
