guix-commits
[Top][All Lists]
Advanced

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

[shepherd] 01/06: service: 'service' errors out when 'provision' is inva


From: Ludovic Courtès
Subject: [shepherd] 01/06: service: 'service' errors out when 'provision' is invalid.
Date: Mon, 12 Jun 2023 09:39:20 -0400 (EDT)

civodul pushed a commit to branch master
in repository shepherd.

commit ad62ce37fe3a69e83672f0817ac2b67e05d0dd87
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Jun 10 23:50:28 2023 +0200

    service: 'service' errors out when 'provision' is invalid.
    
    Partly fixes <https://issues.guix.gnu.org/63979>.
    Reported by Attila Lendvai <attila@lendvai.name>.
    
    * modules/shepherd/service.scm (service): Check that provision is a
    non-empty, proper list of symbols.
    * po/Makevars (XGETTEXT_OPTIONS): Add '--keyword=message'.
---
 modules/shepherd/service.scm | 27 ++++++++++++++++-----------
 po/Makevars                  |  3 ++-
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index fa2d011..6a2b2de 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -333,17 +333,22 @@ Log abnormal termination reported by @var{status}."
                   (documentation (l10n "[No description].")))
   "Return a new service with the given @var{provision}, a list of symbols
 denoting what the service provides."
-  (make <service>
-    #:provides provision
-    #:requires requirement
-    #:one-shot? one-shot?
-    #:transient? transient?
-    #:respawn? respawn?
-    #:start start
-    #:stop stop
-    #:actions actions
-    #:handle-termination termination-handler
-    #:docstring documentation))
+  (match provision
+    (((? symbol?) ..1)
+     (make <service>
+       #:provides provision
+       #:requires requirement
+       #:one-shot? one-shot?
+       #:transient? transient?
+       #:respawn? respawn?
+       #:start start
+       #:stop stop
+       #:actions actions
+       #:handle-termination termination-handler
+       #:docstring documentation))
+    (_
+     (raise (condition
+             (&message (message "invalid service provision list")))))))
 
 (define (service-control service)
   "Return the controlling channel of @var{service}."
diff --git a/po/Makevars b/po/Makevars
index 331946e..3493567 100644
--- a/po/Makevars
+++ b/po/Makevars
@@ -7,7 +7,8 @@ top_builddir = ..
 
 XGETTEXT_OPTIONS =                             \
   --from-code=UTF-8                            \
-  --keyword=l10n --keyword=l10n:1,2
+  --keyword=l10n --keyword=l10n:1,2            \
+  --keyword=message
 
 # Set this to the empty string, which means translations are in the
 # public domain; in this case the translators are expected to disclaim



reply via email to

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