[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/09: syscalls: 'with-lock-file' catches ENOSYS.
From: |
guix-commits |
Subject: |
05/09: syscalls: 'with-lock-file' catches ENOSYS. |
Date: |
Wed, 5 Jun 2019 17:11:22 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 5f0cf1df710cca3eeff6b41ce8e665fb911cfb41
Author: Ludovic Courtès <address@hidden>
Date: Mon Jun 3 17:13:30 2019 +0200
syscalls: 'with-lock-file' catches ENOSYS.
* guix/build/syscalls.scm (call-with-file-lock): Catch ENOSYS raised by
'lock-file'.
---
guix/build/syscalls.scm | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 3af41f2..5c2eb3c 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -1084,13 +1084,24 @@ exception if it's already taken."
#t)
(define (call-with-file-lock file thunk)
- (let ((port (lock-file file)))
+ (let ((port (catch 'system-error
+ (lambda ()
+ (lock-file file))
+ (lambda args
+ ;; When using the statically-linked Guile in the initrd,
+ ;; 'fcntl-flock' returns ENOSYS unconditionally. Ignore
+ ;; that error since we're typically the only process running
+ ;; at this point.
+ (if (= ENOSYS (system-error-errno args))
+ #f
+ (apply throw args))))))
(dynamic-wind
(lambda ()
#t)
thunk
(lambda ()
- (unlock-file port)))))
+ (when port
+ (unlock-file port))))))
(define-syntax-rule (with-file-lock file exp ...)
"Wait to acquire a lock on FILE and evaluate EXP in that context."
- branch master updated (c0f6eeb -> d088d5c), guix-commits, 2019/06/05
- 04/09: syscalls: 'with-file-lock' expands to a call to 'call-with-file-lock'., guix-commits, 2019/06/05
- 02/09: gnu: minizip: Do not install crypt.h., guix-commits, 2019/06/05
- 08/09: accounts: Close database before renaming it., guix-commits, 2019/06/05
- 01/09: guix package: Do not list environment variables that need to be set., guix-commits, 2019/06/05
- 03/09: syscalls: Add 'with-file-lock' macro., guix-commits, 2019/06/05
- 09/09: accounts: Call 'fdatasync' when writing databases., guix-commits, 2019/06/05
- 07/09: nar: Really lock store files., guix-commits, 2019/06/05
- 05/09: syscalls: 'with-lock-file' catches ENOSYS.,
guix-commits <=
- 06/09: activation: Lock /etc/.pwd.lock before accessing databases., guix-commits, 2019/06/05