emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67253: closed ([PATCH] add guix locate database is locked error mess


From: GNU bug Tracking System
Subject: bug#67253: closed ([PATCH] add guix locate database is locked error message(resent))
Date: Sun, 26 Nov 2023 22:25:02 +0000

Your message dated Sun, 26 Nov 2023 23:24:22 +0100
with message-id <87bkbg17c9.fsf@gnu.org>
and subject line Re: [bug#67253] [PATCH] add guix locate database is locked 
error message(resent)
has caused the debbugs.gnu.org bug report #67253,
regarding [PATCH] add guix locate database is locked error message(resent)
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
67253: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=67253
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- 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@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




--- End Message ---
--- Begin Message --- Subject: Re: [bug#67253] [PATCH] add guix locate database is locked error message(resent) Date: Sun, 26 Nov 2023 23:24:22 +0100 User-agent: Gnus/5.13 (Gnus v5.13)
Hi,

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

> Change-Id: Iebe76c75d45e70317bd18d2c176dcdeaf9d6964c
> Signed-off-by: Maciej Kalandyk <m.kalandyk@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@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’.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]