Subject: bug#76141: closed (Re: none)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 15 Apr 2025 15:03:03 +0000

Your bug report

#76141: guix locate --clear tries to write to readonly database

which was filed against the guix package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
76141: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76141
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: none
From: Ludovic Courtès <[email-masked]>
To: [email-masked]
Cc: Josselin Poiret <[email-masked]>, Simon Tournier <[email-masked]>, Mathieu Othacehe <[email-masked]>, Tobias Geerinckx-Rice <[email-masked]>, 76141 <[email-masked]>, Christopher Baines <[email-masked]>
Date: Tue, 15 Apr 2025 15:10:15 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

[email-masked] writes:

> 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

Applied, thanks!

Ludo’.

Subject: guix locate --clear tries to write to readonly database
From: [email-masked]
To: [email-masked]
Date: Sat, 8 Feb 2025 09:19:32 +0100 (CET)
List-Id: <debbugs-submit.debbugs.gnu.org>

When a system wide database exists (at /var/cache/guix/locate/db.sqlite) 'guix locate --clear' invoked as an unprivileged user tries to write to it and fail.
Steps to reproduce:
- sudo mkdir -p /var/cache/guix/locate
- sudo touch /var/cache/guix/locate/db.sqlite
- guix locate --clear
Observe the exception:
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Throw to key `sqlite-error' with args `(sqlite-exec 8 "attempt to write a readonly database")'.

I think the issue is that the 'suitable-database' procedure does not get passed the CREATE? 
parameter (indicating that we want a writable db)  when '--clear'  is given.

I discovered this because this caused the guix-locate.sh test to fail in an normal checkout. 
The db in /var/cache/guix/locate/db.sqlite is created and updated via the package-database-service-type.

Thanks.