all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Attila Lendvai <attila@lendvai.name>
Cc: 55659@debbugs.gnu.org
Subject: [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization.
Date: Thu, 16 Jun 2022 23:11:47 +0200	[thread overview]
Message-ID: <87mtecjoto.fsf@gnu.org> (raw)
In-Reply-To: <20220526130912.29483-1-attila@lendvai.name> (Attila Lendvai's message of "Thu, 26 May 2022 15:09:12 +0200")

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’.




  parent reply	other threads:[~2022-06-16 21:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-26 13:09 [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization Attila Lendvai
2022-05-26 13:13 ` [bug#55659] [PATCH 2/2] gnu: ddclient: Update to 3.10.0_2 (RC2) Attila Lendvai
2022-05-27 11:40   ` Attila Lendvai
2022-06-17  5:38   ` [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization Oleg Pykhalov
2022-06-17  8:26     ` Attila Lendvai
2022-06-16 21:11 ` Ludovic Courtès [this message]
2022-06-17  8:53   ` Attila Lendvai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mtecjoto.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=55659@debbugs.gnu.org \
    --cc=attila@lendvai.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.