Subject: bug#76141:

From: [email-masked]
Date: Sun, 13 Apr 2025 11:26:23 +0200 (CEST)

Something like this fixes my issue.

>From c6333e210b6fd38b710800d9fc9b898f9b4409e2 Mon Sep 17 00:00:00 2001
Message-ID: <[email-masked]>
From: Yelninei <[email-masked]>
Date: Sun, 13 Apr 2025 09:08:39 +0000
Subject: [PATCH] locate: Request writable db for --clear.

Fixes https://issues.guix.gnu.org/76141.

* guix/scripts/locate.scm (guix-locate): Use writable db when --clear is given.

Change-Id: I2e4e945cef022b08dd6af4c252e67c2a4d5bf38c
---
 guix/scripts/locate.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/guix/scripts/locate.scm b/guix/scripts/locate.scm
index f8ee875c7c..b42011f8c4 100644
--- a/guix/scripts/locate.scm
+++ b/guix/scripts/locate.scm
@@ -624,7 +624,8 @@ (define-command (guix-locate . args)
            (clear?   (assoc-ref opts 'clear?))
            (update?  (assoc-ref opts 'update?))
            (glob?    (assoc-ref opts 'glob?))
-           (database ((assoc-ref opts 'database) update? age-update-threshold))
+           (database ((assoc-ref opts 'database)
+                      (or clear? update?) age-update-threshold))
            (method   (assoc-ref opts 'method))
            (files    (reverse (filter-map (match-lambda
                                             (('argument . arg) arg)

base-commit: a33e152f2eb9927be5942b00bdaaecba737c650f
-- 
2.49.0