guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 615e1b3ac515da3ae77d1dc3e3fa8a7d7ec5c8c6
Author: Ludovic Courtès <[email protected]>
AuthorDate: Sun Oct 25 20:53:19 2026 +0100

    services: shepherd: Fix unbound-variable error in error situation.
    
    This fixes a bug introduced in d8373c2a9a945f4bedfddef1e532982adb75e3db 
where
    the ‘file’ variable in ‘maybe-fail-safe’ would be unbound.  Consequently, on
    the Shepherd 1.0, failure to load a single service (exception thrown while
    loading its file) would prevent the system from booting.
    
    * gnu/services/shepherd.scm (shepherd-configuration-file/unchecked): Add
    ‘file’ parameter to ‘maybe-fail-safe’ and update caller accordingly.
    
    Signed-off-by: Ludovic Courtès <[email protected]>
    Merges: #12110
---
 gnu/services/shepherd.scm | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index d531eaef501..45fb95597a3 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -456,8 +456,8 @@ as shepherd package."
             ;; asked not to.  TODO: Remove this once the Shepherd 1.1 is the
             ;; default.
             (if (getenv "GUIX_SHEPHERD_FAIL_HARD")
-                (lambda (thunk) (thunk))
-                (lambda (thunk)
+                (lambda (file thunk) (thunk))
+                (lambda (file thunk)
                   (with-exception-handler
                       (lambda (exception)
                         (format #t "Exception caught \
@@ -486,11 +486,12 @@ while loading '~a': ~s~%"
            (parameterize ((current-warning-port (%make-void-port "w")))
              (filter-map (lambda (file)
                            (maybe-fail-safe
-                             (lambda ()
-                               (save-module-excursion
-                                (lambda ()
-                                  (set-current-module (make-user-module))
-                                  (primitive-load file))))))
+                            file
+                            (lambda ()
+                              (save-module-excursion
+                               (lambda ()
+                                 (set-current-module (make-user-module))
+                                 (primitive-load file))))))
                          ;; Note: We used to pre-compile FILES, but the
                          ;; problem is that 'load-compiled' is a continuation
                          ;; barrier as of 3.0.10, which could be a problem

Reply via email to