Subject: Re: [bug#67253] [PATCH] add guix locate database is locked error message(resent)

From: Ludovic Courtès <[email-masked]>
Date: Sun, 26 Nov 2023 23:24:22 +0100

Hi,

Maciej Kalandyk <[email-masked]> skribis:

> Change-Id: Iebe76c75d45e70317bd18d2c176dcdeaf9d6964c
> Signed-off-by: Maciej Kalandyk <[email-masked]>

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

--8<---------------cut here---------------start------------->8---
;; XXX: missing in [email-masked]
(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’.