aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-02-05 13:07:57 +0100
committerLudovic Courtès <ludo@gnu.org>2016-02-05 14:01:46 +0100
commit081bd3bd29c8af228c237a178c171fcdf05425cf (patch)
treee94e714de3e8c3fb190fa082991eca4525a669b1 /gnu
parent1d6b7d584736ff0ad9e852a39c7c151e10713580 (diff)
downloadguix-081bd3bd29c8af228c237a178c171fcdf05425cf.tar.gz
guix-081bd3bd29c8af228c237a178c171fcdf05425cf.zip
service: shepherd: Guard against exceptions raised by 'start'.
Fixes <http://bugs.gnu.org/22548>. Reported by Albin <albin@fripost.org>, Mark H Weaver, and Alex Kost. * gnu/services/shepherd.scm (shepherd-configuration-file)[config]: Guard against 'service-error?'.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/shepherd.scm14
1 files changed, 12 insertions, 2 deletions
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 6cf15a5e00..207501cb1a 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -234,7 +234,8 @@ stored."
(set! %load-compiled-path
(cons #$compiled %load-compiled-path)))
- (use-modules (system repl error-handling))
+ (use-modules (srfi srfi-34)
+ (system repl error-handling))
;; Arrange to spawn a REPL if loading one of FILES fails. This is
;; better than a kernel panic.
@@ -246,7 +247,16 @@ stored."
(setenv "PATH" "/run/current-system/profile/bin")
(format #t "starting services...~%")
- (for-each start
+ (for-each (lambda (service)
+ ;; In the Shepherd 0.3 the 'start' method can raise
+ ;; '&action-runtime-error' if it fails, so protect
+ ;; against it. (XXX: 'action-runtime-error?' is not
+ ;; exported is 0.3, hence 'service-error?'.)
+ (guard (c ((service-error? c)
+ (format (current-error-port)
+ "failed to start service '~a'~%"
+ service)))
+ (start service)))
'#$(append-map shepherd-service-provision
(filter shepherd-service-auto-start?
services)))))