[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/10: services: Validate 'provision' field of <shepherd-service>.
From: |
guix-commits |
Subject: |
03/10: services: Validate 'provision' field of <shepherd-service>. |
Date: |
Sun, 25 Jun 2023 17:47:02 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 6c0e7b266523a2cc381c76392c830a237d9e41a9
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Jun 25 23:31:11 2023 +0200
services: Validate 'provision' field of <shepherd-service>.
Fixes <https://issues.guix.gnu.org/63979>.
* gnu/services/shepherd.scm (validate-provision): New procedure.
(<shepherd-service>)[provision]: Use it.
Co-authored-by: Bruno Victal <mirai@makinata.eu>
---
gnu/services/shepherd.scm | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index de40454f7d..e9d3a631c2 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -27,8 +27,9 @@
#:use-module (guix store)
#:use-module (guix records)
#:use-module (guix packages)
- #:use-module (guix derivations) ;imported-modules, etc.
#:use-module (guix utils)
+ #:use-module ((guix diagnostics)
+ #:select (define-with-syntax-properties formatted-message))
#:use-module (gnu services)
#:use-module (gnu services herd)
#:use-module (gnu packages admin)
@@ -186,12 +187,25 @@ DEFAULT is given, use it as the service's default value."
((guix build utils) #:hide (delete))
(guix build syscalls)))
+(define-with-syntax-properties (validate-provision (provision properties))
+ (match provision
+ (((? symbol?) ..1) provision)
+ (_
+ (raise
+ (make-compound-condition
+ (condition
+ (&error-location
+ (location (source-properties->location properties))))
+ (formatted-message
+ (G_ "'provision' must be a non-empty list of symbols")))))))
+
(define-record-type* <shepherd-service>
shepherd-service make-shepherd-service
shepherd-service?
(documentation shepherd-service-documentation ;string
(default "[No documentation.]"))
- (provision shepherd-service-provision) ;list of symbols
+ (provision shepherd-service-provision ;list of symbols
+ (sanitize validate-provision))
(requirement shepherd-service-requirement ;list of symbols
(default '()))
(one-shot? shepherd-service-one-shot? ;Boolean
- branch master updated (41e8726c89 -> 269cfe341f), guix-commits, 2023/06/25
- 05/10: gnu: python-mypy-extensions: Update to 1.0.0, guix-commits, 2023/06/25
- 08/10: gnu: python-trimesh: Update to 3.22.1., guix-commits, 2023/06/25
- 10/10: gnu: aws-sdk-cpp: Update to 1.9.306., guix-commits, 2023/06/25
- 03/10: services: Validate 'provision' field of <shepherd-service>.,
guix-commits <=
- 01/10: gnu: mmg: Update to 5.7.1., guix-commits, 2023/06/25
- 09/10: gnu: aws-lc: Fix tests., guix-commits, 2023/06/25
- 02/10: gnu: nomad-optimizer: Fix build., guix-commits, 2023/06/25
- 04/10: gnu: oneapi-dnnl: Fix building on riscv64-linux., guix-commits, 2023/06/25
- 07/10: gnu: fswatch: Update to 1.17.1., guix-commits, 2023/06/25
- 06/10: gnu: python-mypy-extensions: Fix style, guix-commits, 2023/06/25