guix-commits
[Top][All Lists]
Advanced

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

06/07: ui: 'with-profile-lock' keeps going upon ENOLCK.


From: guix-commits
Subject: 06/07: ui: 'with-profile-lock' keeps going upon ENOLCK.
Date: Fri, 29 Nov 2019 09:54:29 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 3f8e890d91975a26ecb417e9115805159aa3170d
Author: Ludovic Courtès <address@hidden>
Date:   Fri Nov 29 15:11:51 2019 +0100

    ui: 'with-profile-lock' keeps going upon ENOLCK.
    
    * guix/build/syscalls.scm (call-with-file-lock/no-wait): Really pass
    ARGS to HANDLER.  Return #f when HANDLER is called.
    * guix/ui.scm (profile-lock-handler): Emit a mere warning upon ENOLCK.
---
 guix/build/syscalls.scm | 4 +++-
 guix/ui.scm             | 9 +++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index a5a9c92..ce7999b 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -1127,7 +1127,9 @@ exception if it's already taken."
                 (lambda (key . args)
                   (match key
                     ('flock-error
-                     (handler args))
+                     (apply handler args)
+                     ;; No open port to the lock, so return #f.
+                     #f)
                     ('system-error
                       ;; When using the statically-linked Guile in the initrd,
                       ;; 'fcntl-flock' returns ENOSYS unconditionally.  Ignore
diff --git a/guix/ui.scm b/guix/ui.scm
index f4aa6e2..540671f 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1666,8 +1666,13 @@ DURATION-RELATION with the current time."
 
 (define (profile-lock-handler profile errno . _)
   "Handle failure to acquire PROFILE's lock."
-  (leave (G_ "profile ~a is locked by another process~%")
-         profile))
+  ;; NFS mounts can return ENOLCK.  When that happens, there's not much that
+  ;; can be done, so warn the user and keep going.
+  (if (= errno ENOLCK)
+      (warning (G_ "cannot lock profile ~a: ~a~%")
+               profile (strerror errno))
+      (leave (G_ "profile ~a is locked by another process~%")
+             profile)))
 
 (define profile-lock-file
   (cut string-append <> ".lock"))



reply via email to

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