GNU bug report logs - #67253
[PATCH] add guix locate database is locked error message(resent)

Previous Next

Package: guix-patches;

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

Date: Sat, 18 Nov 2023 00:37: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 67253 in the body.
You can then email your comments to 67253 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#67253; Package guix-patches. (Sat, 18 Nov 2023 00:37:01 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, 18 Nov 2023 00:37:01 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] add guix locate database is locked error message(resent)
Date: Sat, 18 Nov 2023 01:30:39 +0100
Change-Id: Iebe76c75d45e70317bd18d2c176dcdeaf9d6964c
Signed-off-by: Maciej Kalandyk <m.kalandyk <at> outlook.com>
---
 guix/scripts/locate.scm | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/guix/scripts/locate.scm b/guix/scripts/locate.scm
index ae64f46896..c24e969be7 100644
--- a/guix/scripts/locate.scm
+++ b/guix/scripts/locate.scm
@@ -115,13 +115,21 @@ (define schema-to-migrate '((1 . "
 ")))
 
 (define (call-with-database file proc)
-  (let ((db (sqlite-open file)))
-    (dynamic-wind
-      (lambda () #t)
-      (lambda ()
-        (ensure-latest-database-schema db)
-        (proc db))
-      (lambda () (sqlite-close db)))))
+  (catch 'sqlite-error
+    (lambda ()
+      (let ((db (sqlite-open file)))
+        (dynamic-wind
+          (lambda () #t)
+          (lambda ()
+            (ensure-latest-database-schema db)
+            (proc db))
+          (lambda () (sqlite-close db)))))
+    (lambda (key . args)
+      (match args
+        [(_ 5 _)
+         (leave (G_ "database ~a is locked by another process~%")
+                file)]
+        [_ (apply throw (cons key args))]))))
 
 (define (ensure-latest-database-schema db)
   "Ensure DB follows the latest known version of the schema."

base-commit: a0d337e79c87d7c38c79d0291974f490cb137a52
-- 
2.41.0





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

Notification sent to Maciej Kalandyk <m.kalandyk <at> outlook.com>:
bug acknowledged by developer. (Sun, 26 Nov 2023 22:25:02 GMT) Full text and rfc822 format available.

Message #10 received at 67253-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: 67253-done <at> debbugs.gnu.org, Simon Tournier <zimon.toutoune <at> gmail.com>,
 Mathieu Othacehe <othacehe <at> gnu.org>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Josselin Poiret <dev <at> jpoiret.xyz>, Ricardo Wurmus <rekado <at> elephly.net>,
 Christopher Baines <guix <at> cbaines.net>
Subject: Re: [bug#67253] [PATCH] add guix locate database is locked error
 message(resent)
Date: Sun, 26 Nov 2023 23:24:22 +0100
Hi,

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

> Change-Id: Iebe76c75d45e70317bd18d2c176dcdeaf9d6964c
> Signed-off-by: Maciej Kalandyk <m.kalandyk <at> outlook.com>

I tweaked the exception handler to clarify what’s happening.  The end
result looks like this:

--8<---------------cut here---------------start------------->8---
;; XXX: missing in guile-sqlite3 <at> 0.1.3
(define SQLITE_BUSY 5)

(define (call-with-database file proc)
  (catch 'sqlite-error
    (lambda ()
      (let ((db (sqlite-open file)))
        (dynamic-wind
          (lambda () #t)
          (lambda ()
            (ensure-latest-database-schema db)
            (proc db))
          (lambda () (sqlite-close db)))))
    (lambda (key who code errmsg)
      (if (= code SQLITE_BUSY)
          (leave (G_ "~a: database is locked by another process~%")
                 file)
          (throw key who code errmsg)))))
--8<---------------cut here---------------end--------------->8---

Applied, thanks!

Ludo’.




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

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

Previous Next


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