Subject: bug#64119: closed (Re: bug#64119: [PATCH] services: shepherd: Sanitize 'provision' field.)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 25 Jun 2023 21:09:02 +0000

Your bug report

#64119: [PATCH] services: shepherd: Sanitize 'provision' field.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
64119: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64119
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#64119: [PATCH] services: shepherd: Sanitize 'provision' field.
From: Ludovic Courtès <[email-masked]>
To: Bruno Victal <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Sun, 25 Jun 2023 23:08:20 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Bruno,

Bruno Victal <[email-masked]> skribis:

> Fixes <https://issues.guix.gnu.org/63979>.
>
> * gnu/services/shepherd.scm (<shepherd-service>)[provision]: Set field
> sanitizer.
> (sanitize-shepherd-service-provision): New procedure.

Applied, thanks!

Ludo’.

Subject: [PATCH] services: shepherd: Sanitize 'provision' field.
From: Bruno Victal <[email-masked]>
To: [email-masked]
Cc: Bruno Victal <[email-masked]>
Date: Fri, 16 Jun 2023 21:25:24 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Fixes <https://issues.guix.gnu.org/63979>.

* gnu/services/shepherd.scm (<shepherd-service>)[provision]: Set field
sanitizer.
(sanitize-shepherd-service-provision): New procedure.
---
 gnu/services/shepherd.scm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index de40454f7d..1333067817 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2018 Carlo Zancanaro <[email-masked]>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <[email-masked]>
 ;;; Copyright © 2021 Maxime Devos <[email-masked]>
+;;; Copyright © 2023 Bruno Victal <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,6 +22,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu services shepherd)
+  #:use-module (guix diagnostics)
   #:use-module (guix ui)
   #:use-module (guix sets)
   #:use-module (guix gexp)
@@ -186,12 +188,21 @@ (define %default-modules
     ((guix build utils) #:hide (delete))
     (guix build syscalls)))
 
+(define (sanitize-shepherd-service-provision expr)
+  (match expr
+    (((? symbol?) ..1) expr)
+    (_
+     (raise
+      (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 sanitize-shepherd-service-provision))
   (requirement   shepherd-service-requirement          ;list of symbols
                  (default '()))
   (one-shot?     shepherd-service-one-shot?            ;Boolean

base-commit: 31336e9f5d68512a9c1c6826bce9f17c892a2125
-- 
2.39.2