* bug#66754: No guix locate lock error handling
@ 2023-10-26 1:04 Maciej Kalandyk
2023-10-28 17:11 ` bug#66754: [PATCH] add guix locate database is locked error message Maciej Kalandyk
0 siblings, 1 reply; 3+ messages in thread
From: Maciej Kalandyk @ 2023-10-26 1:04 UTC (permalink / raw)
To: 66754
If you run guix locate when another guix locate that is generating
database is running the former is going to crash with database is locked
"raw" error
It should either wait for lock to be released or display an "formatted" error
guix describe:
guix e0b94a4
repository URL: https://git.savannah.gnu.org/git/guix.git
branch: master
commit: e0b94a4d27e6edbc7a87eafdf6fd0e163e0646db
nonguix 182ce51
repository URL: https://gitlab.com/nonguix/nonguix
branch: master
commit: 182ce510b5355163fd286553a6fec40bd7935069
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#66754: [PATCH] add guix locate database is locked error message
2023-10-26 1:04 bug#66754: No guix locate lock error handling Maciej Kalandyk
@ 2023-10-28 17:11 ` Maciej Kalandyk
2023-11-30 11:55 ` Simon Tournier
0 siblings, 1 reply; 3+ messages in thread
From: Maciej Kalandyk @ 2023-10-28 17:11 UTC (permalink / raw)
To: 66754
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 93faa1aea2..a6b6036052 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: 6d7e181ba18d11c92409a93936025fb46b9c8171
prerequisite-patch-id: 9ba8ba9723e24b3d15f07622ff1c5ae78567f6cd
--
2.41.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-30 18:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-26 1:04 bug#66754: No guix locate lock error handling Maciej Kalandyk
2023-10-28 17:11 ` bug#66754: [PATCH] add guix locate database is locked error message Maciej Kalandyk
2023-11-30 11:55 ` Simon Tournier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).