guix-patches
[Top][All Lists]
Advanced

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

[bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serializat


From: Ludovic Courtès
Subject: [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization.
Date: Thu, 16 Jun 2022 23:11:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)

Hi,

Attila Lendvai <attila@lendvai.name> skribis:

> Prior to this fix it has serialized "extra-options=..." into the ddclient.conf
> file.

[...]

>  (define (serialize-field field-name val)
> -  (when (not (member field-name '(group secret-file user)))
> -    (format #t "~a=~a\n" (uglify-field-name field-name) val)))
> +  (cond
> +   ((eq? field-name 'extra-options)
> +    (display val))
> +   ((not (member field-name '(group secret-file user)))
> +    (format #t "~a=~a\n" (uglify-field-name field-name) val))))
>  
>  (define (serialize-boolean field-name val)
>    (serialize-field field-name (if val "yes" "no")))
> @@ -921,9 +924,6 @@ (define (serialize-string field-name val)
>  (define (serialize-list field-name val)
>    (if (null? val) "" (serialize-field field-name (string-join val))))
>  
> -(define (serialize-extra-options extra-options)
> -  (string-join extra-options "\n" 'suffix))
> -
>  (define-configuration ddclient-configuration
>    (ddclient
>     (file-like ddclient)
> @@ -959,8 +959,8 @@ (define-configuration ddclient-configuration
>  file contains credentials for use by ddclient.  You are expected to create it
>  manually.")
>    (extra-options
> -   (list '())
> -   "Extra options will be appended to @file{ddclient.conf} file."))
> +   (string "")
> +   "Extra options will be appended verbatim to the @file{ddclient.conf} 
> file."))

In other places, such as (gnu home services desktop), I’ve used an extra
‘raw-configuration-string’ field type to handle this cases.  This might
be clearer than adding the ‘cond’ above in ‘serialize-field’.  WDYT?

The change above also changes the interface (from list to string), but I
think that’s OK.

Thanks,
Ludo’.





reply via email to

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