GNU bug report logs - #64119
[PATCH] services: shepherd: Sanitize 'provision' field.

Previous Next

Package: guix-patches;

Reported by: Bruno Victal <mirai <at> makinata.eu>

Date: Fri, 16 Jun 2023 20:26:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 64119 in the body.
You can then email your comments to 64119 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to ludo <at> gnu.org, attila <at> lendvai.name, guix-patches <at> gnu.org:
bug#64119; Package guix-patches. (Fri, 16 Jun 2023 20:26:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bruno Victal <mirai <at> makinata.eu>:
New bug report received and forwarded. Copy sent to ludo <at> gnu.org, attila <at> lendvai.name, guix-patches <at> gnu.org. (Fri, 16 Jun 2023 20:26:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bruno Victal <mirai <at> makinata.eu>
To: guix-patches <at> gnu.org
Cc: Bruno Victal <mirai <at> makinata.eu>
Subject: [PATCH] services: shepherd: Sanitize 'provision' field.
Date: Fri, 16 Jun 2023 21:25:24 +0100
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 <carlo <at> zancanaro.id.au>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
 ;;; Copyright © 2021 Maxime Devos <maximedevos <at> telenet.be>
+;;; Copyright © 2023 Bruno Victal <mirai <at> makinata.eu>
 ;;;
 ;;; 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





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 25 Jun 2023 21:09:02 GMT) Full text and rfc822 format available.

Notification sent to Bruno Victal <mirai <at> makinata.eu>:
bug acknowledged by developer. (Sun, 25 Jun 2023 21:09:02 GMT) Full text and rfc822 format available.

Message #10 received at 64119-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Bruno Victal <mirai <at> makinata.eu>
Cc: attila <at> lendvai.name, 64119-done <at> debbugs.gnu.org
Subject: Re: bug#64119: [PATCH] services: shepherd: Sanitize 'provision' field.
Date: Sun, 25 Jun 2023 23:08:20 +0200
Hi Bruno,

Bruno Victal <mirai <at> makinata.eu> 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’.




Information forwarded to guix-patches <at> gnu.org:
bug#64119; Package guix-patches. (Sun, 25 Jun 2023 21:46:01 GMT) Full text and rfc822 format available.

Message #13 received at 64119 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Bruno Victal <mirai <at> makinata.eu>
Cc: attila <at> lendvai.name, 64119 <at> debbugs.gnu.org, 63979-done <at> debbugs.gnu.org
Subject: Re: bug#64119: [PATCH] services: shepherd: Sanitize 'provision' field.
Date: Sun, 25 Jun 2023 23:44:53 +0200
Bruno Victal <mirai <at> makinata.eu> skribis:

> +(define (sanitize-shepherd-service-provision expr)
> +  (match expr
> +    (((? symbol?) ..1) expr)
> +    (_
> +     (raise
> +      (formatted-message
> +       (G_ "'provision' must be a non-empty list of symbols"))))))

Actually I figured we could do as in other areas of the code in a way
that reports error location, so I came up with a different patch.

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 24 Jul 2023 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 336 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.