GNU bug report logs - #66799
[PATCH] Fix guix locate clear database "no files to search for" error and unnesecary database rebuilding

Previous Next

Package: guix-patches;

Reported by: Maciej Kalandyk <m.kalandyk <at> outlook.com>

Date: Sat, 28 Oct 2023 17:50:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 66799 in the body.
You can then email your comments to 66799 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#66799; Package guix-patches. (Sat, 28 Oct 2023 17:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maciej Kalandyk <m.kalandyk <at> outlook.com>:
New bug report received and forwarded. Copy sent to guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org. (Sat, 28 Oct 2023 17:50:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Maciej Kalandyk <m.kalandyk <at> outlook.com>
To: guix-patches <at> gnu.org
Cc: Maciej Kalandyk <m.kalandyk <at> outlook.com>
Subject: [PATCH] Fix guix locate clear database "no files to search for" error
 and unnesecary database rebuilding
Date: Sat, 28 Oct 2023 19:43:25 +0200
This patch fixes error with guix locate --clear that causes it to display error when no files are supplied

Change-Id: I0e9ca223d6406c78b0dd8ff93976c3077d89e103
Signed-off-by: Maciej Kalandyk <m.kalandyk <at> outlook.com>
---
 guix/scripts/locate.scm | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/guix/scripts/locate.scm b/guix/scripts/locate.scm
index ae64f46896..93faa1aea2 100644
--- a/guix/scripts/locate.scm
+++ b/guix/scripts/locate.scm
@@ -634,6 +634,9 @@ (define-command (guix-locate . args)
               (_
                (leave (G_ "~a: unknown indexing method~%") method))))))
 
+      (if (and (null? files) (not (or update? clear?)))
+          (leave (G_ "no files to search for~%")))
+
       ;; Populate the database if needed.
       (let* ((stat   (stat database #f))
              (age    (and stat (file-age stat)))
@@ -649,20 +652,18 @@ (define-command (guix-locate . args)
 
       (if (assoc-ref opts 'stats?)
           (print-statistics database)
-          (match (call-with-database database
-                   (lambda (db)
-                     (append-map (lambda (file)
-                                   (matching-packages db file
-                                                      #:glob? glob?))
-                                 files)))
-            (()
-             (if (null? files)
-                 (unless update?
-                   (leave (G_ "no files to search for~%")))
+          (unless (null? files)
+              (match (call-with-database database
+                       (lambda (db)
+                         (append-map (lambda (file)
+                                       (matching-packages db file
+                                                          #:glob? glob?))
+                                     files)))
+                (()
                  (leave (N_ "file~{ '~a'~} not found in database '~a'~%"
                             "files~{ '~a'~} not found in database '~a'~%"
                             (length files))
-                        files database)))
-            (matches
-             (leave-on-EPIPE
-              (print-matching-results matches))))))))
+                        files database))
+                (matches
+                 (leave-on-EPIPE
+                  (print-matching-results matches)))))))))

base-commit: 6d7e181ba18d11c92409a93936025fb46b9c8171
-- 
2.41.0





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 15 Nov 2023 17:37:02 GMT) Full text and rfc822 format available.

Notification sent to Maciej Kalandyk <m.kalandyk <at> outlook.com>:
bug acknowledged by developer. (Wed, 15 Nov 2023 17:37:02 GMT) Full text and rfc822 format available.

Message #10 received at 66799-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maciej Kalandyk <m.kalandyk <at> outlook.com>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Tobias Geerinckx-Rice <me <at> tobias.gr>, Ricardo Wurmus <rekado <at> elephly.net>,
 66799-done <at> debbugs.gnu.org, Christopher Baines <guix <at> cbaines.net>
Subject: Re: [bug#66799] [PATCH] Fix guix locate clear database "no files to
 search for" error and unnesecary database rebuilding
Date: Wed, 15 Nov 2023 18:36:28 +0100
Hi Maciej,

Maciej Kalandyk <m.kalandyk <at> outlook.com> skribis:

> This patch fixes error with guix locate --clear that causes it to display error when no files are supplied
>
> Change-Id: I0e9ca223d6406c78b0dd8ff93976c3077d89e103
> Signed-off-by: Maciej Kalandyk <m.kalandyk <at> outlook.com>

I fixed it slightly differently in
69d9a020949c77c77b449c1faf04397b95eef5b7 and added a test in
‘tests/guix-locate.sh’ so this bug doesn’t come to haunt us again.

Thank you!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 14 Dec 2023 12:24:18 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 147 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.