GNU bug report logs - #55659
[PATCH 1/2] services: ddclient: Fix extra-options serialization.

Previous Next

Package: guix-patches;

Reported by: Attila Lendvai <attila <at> lendvai.name>

Date: Thu, 26 May 2022 13:12:02 UTC

Severity: normal

Tags: patch, wontfix

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 55659 in the body.
You can then email your comments to 55659 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 guix-patches <at> gnu.org:
bug#55659; Package guix-patches. (Thu, 26 May 2022 13:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Attila Lendvai <attila <at> lendvai.name>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 26 May 2022 13:12:02 GMT) Full text and rfc822 format available.

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

From: Attila Lendvai <attila <at> lendvai.name>
To: guix-patches <at> gnu.org
Cc: Attila Lendvai <attila <at> lendvai.name>
Subject: [PATCH 1/2] services: ddclient: Fix extra-options serialization.
Date: Thu, 26 May 2022 15:09:12 +0200
Prior to this fix it has serialized "extra-options=..." into the ddclient.conf
file.

* gnu/services/dns.scm (serialize-field): Special case for extra-options.
(serialize-extra-options): Deleted unused function.
(ddclient-configuration): Change the type of the extra-options field to be a
string, and emit it verbatime into the ddclient.conf file. Change
docstring accordingly.
---

please note that even though this does fix an issue, i have abandoned
further work on ddclient. so, this is an improvement indeed, but i
suspect that this does not fully fix ddclient. looks like the conf
file format is different than what the current code emits.

the next patch updates ddclient to an RC2 of the next version,
which will be a major upgrade.

 gnu/services/dns.scm | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm
index 50753b7ab6..c2ede312e8 100644
--- a/gnu/services/dns.scm
+++ b/gnu/services/dns.scm
@@ -904,8 +904,11 @@ (define (uglify-field-name field-name)
   (string-delete #\? (symbol->string field-name)))
 
 (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."))
 
 (define (ddclient-account config)
   "Return the user accounts and user groups for CONFIG."
-- 
2.35.1





Information forwarded to guix-patches <at> gnu.org:
bug#55659; Package guix-patches. (Thu, 26 May 2022 13:18:01 GMT) Full text and rfc822 format available.

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

From: Attila Lendvai <attila <at> lendvai.name>
To: 55659 <at> debbugs.gnu.org
Cc: Attila Lendvai <attila <at> lendvai.name>
Subject: [PATCH 2/2] gnu: ddclient: Update to 3.10.0_2 (RC2).
Date: Thu, 26 May 2022 15:13:16 +0200
---

note that this seems to work, but is not fully tested. i have
abandoned the use of ddclient and with that this patchset.

also note that i'm not sure why the use of wrap-program is needed, but
without that it was missing some perl modules at runtime.

 gnu/packages/dns.scm | 76 ++++++++++++++++----------------------------
 1 file changed, 27 insertions(+), 49 deletions(-)

diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm
index fea255c930..0430415b3f 100644
--- a/gnu/packages/dns.scm
+++ b/gnu/packages/dns.scm
@@ -64,6 +64,7 @@ (define-module (gnu packages dns)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages perl-check)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages python)
@@ -1094,7 +1095,7 @@ (define-public knot-resolver
 (define-public ddclient
   (package
     (name "ddclient")
-    (version "3.9.1")
+    (version "3.10.0_2")
     (source
      (origin
        (method git-fetch)
@@ -1103,62 +1104,39 @@ (define-public ddclient
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0hf377g4j9r9sac75xp17nk2h58mazswz4vkg4g2gl2yyhvzq91w"))))
-    (build-system trivial-build-system) ; no Makefile.PL
+        (base32 "0jl658yr867y65hh054wg5gbzxsgpsf57qlc182ni4vwgqkrsrd1"))))
+    (build-system gnu-build-system)
     (native-inputs
-     (list bash perl))
+     (list bash autoconf automake
+           perl
+           ;; For the tests.
+           perl-try-tiny perl-test-warnings perl-http-daemon-ssl
+           perl-io-socket-inet6 perl-test-www-mechanize-psgi
+           perl-test-mockmodule))
     (inputs
      (list inetutils ; logger
            net-tools
+           perl
            perl-data-validate-ip
            perl-digest-sha1
            perl-io-socket-ssl))
     (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils)
-                      (ice-9 match)
-                      (srfi srfi-26))
-         (setenv "PATH" (string-append
-                         (assoc-ref %build-inputs "bash") "/bin" ":"
-                         (assoc-ref %build-inputs "perl") "/bin"))
-
-         ;; Copy the (read-only) source into the (writable) build directory.
-         (copy-recursively (assoc-ref %build-inputs "source") ".")
-
-         ;; Install.
-         (let* ((out (assoc-ref %outputs "out"))
-                (bin (string-append out "/bin")))
-           (let ((file "ddclient"))
-             (substitute* file
-               (("/usr/bin/perl") (which "perl"))
-               ;; Strictly use ‘/etc/ddclient/ddclient.conf’.
-               (("\\$\\{program\\}\\.conf") "/etc/ddclient/ddclient.conf")
-               (("\\$etc\\$program.conf") "/etc/ddclient/ddclient.conf")
-               ;; Strictly use ‘/var/cache/ddclient/ddclient.cache’
-               (("\\$cachedir\\$program\\.cache")
-                "/var/cache/ddclient/ddclient.cache"))
-             (install-file file bin)
-             (wrap-program (string-append bin "/" file)
-               `("PATH" ":" =
-                 ("$PATH"
-                  ,@(map (lambda (input)
-                           (match input
-                                  ((name . store)
-                                   (string-append store "/bin"))))
-                         %build-inputs)))
-               `("PERL5LIB" ":" =
-                 ,(delete
-                   ""
-                   (map (match-lambda
-                         (((? (cut string-prefix? "perl-" <>) name) . dir)
-                          (string-append dir "/lib/perl5/site_perl"))
-                         (_ ""))
-                        %build-inputs)))))
-           (for-each (cut install-file <> (string-append out
-                                                         "/share/ddclient"))
-                     (find-files "." "sample.*$"))))))
+     ;; The tests run mostly clean (6 failures), but I think they depend on
+     ;; the network config of the machine running them, so I turned them off.
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'change-dependencies
+           (lambda* (#:key native-inputs target #:allow-other-keys)
+             (substitute* "configure.ac"
+               (("HTTP::Daemon=6.12") "HTTP::Daemon=6.14"))))
+         (add-after 'install 'wrap-ddclient
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out")))
+               (wrap-program (string-append out "/bin/ddclient")
+                 `("PERL5LIB" ":" prefix
+                   (,(getenv "PERL5LIB")
+                    ,(string-append out "/lib/perl5/site_perl"))))))))))
     (home-page "https://ddclient.net/")
     (synopsis "Address updating utility for dynamic DNS services")
     (description "This package provides a client to update dynamic IP
-- 
2.35.1





Information forwarded to guix-patches <at> gnu.org:
bug#55659; Package guix-patches. (Fri, 27 May 2022 11:42:02 GMT) Full text and rfc822 format available.

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

From: Attila Lendvai <attila <at> lendvai.name>
To: 55659 <at> debbugs.gnu.org
Subject: Re: [PATCH 2/2] gnu: ddclient: Update to 3.10.0_2 (RC2).
Date: Fri, 27 May 2022 11:40:33 +0000
note: this requires https://issues.guix.gnu.org/55656

--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“In a democracy, mass opinion creates power. Power diverts funds to the manufacturers of opinion, who manufacture more, etc. […] This feedback loop generates a playing field on which the most competitive ideas are not those which best correspond to reality, but those which produce the strongest feedback.”
	— Mencius Moldbug





Information forwarded to guix-patches <at> gnu.org:
bug#55659; Package guix-patches. (Thu, 16 Jun 2022 21:13:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Attila Lendvai <attila <at> lendvai.name>
Cc: 55659 <at> debbugs.gnu.org
Subject: Re: bug#55659: [PATCH 1/2] services: ddclient: Fix extra-options
 serialization.
Date: Thu, 16 Jun 2022 23:11:47 +0200
Hi,

Attila Lendvai <attila <at> 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’.




Information forwarded to guix-patches <at> gnu.org:
bug#55659; Package guix-patches. (Fri, 17 Jun 2022 05:39:02 GMT) Full text and rfc822 format available.

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

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Attila Lendvai <attila <at> lendvai.name>
Cc: 55659 <at> debbugs.gnu.org
Subject: Re: bug#55659: [PATCH 1/2] services: ddclient: Fix extra-options
 serialization.
Date: Fri, 17 Jun 2022 08:38:14 +0300
[Message part 1 (text/plain, inline)]
Hi,

Attila Lendvai <attila <at> lendvai.name> writes:

> note that this seems to work, but is not fully tested. i have
> abandoned the use of ddclient and with that this patchset.

I use it on my system, and could test it.

[…]

>      (native-inputs
> -     (list bash perl))
> +     (list bash autoconf automake
> +           perl
> +           ;; For the tests.
> +           perl-try-tiny perl-test-warnings perl-http-daemon-ssl
> +           perl-io-socket-inet6 perl-test-www-mechanize-psgi
> +           perl-test-mockmodule))

Applied on current master 6fc33d91ba6b07beae8a9a38a5b768511bb79ced:
--8<---------------cut here---------------start------------->8---
oleg <at> guixsd ~/src/guix [env]$ ./pre-inst-env guix build ddclient
gnu/packages/dns.scm:1113:44: In procedure native-inputs:
error: perl-http-daemon-ssl: unbound variable
hint: Did you forget a `use-modules' form?
--8<---------------cut here---------------end--------------->8---

Did you forget to attach a patch adding the perl-http-daemon-ssl?

[…]

Oleg.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#55659; Package guix-patches. (Fri, 17 Jun 2022 08:28:02 GMT) Full text and rfc822 format available.

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

From: Attila Lendvai <attila <at> lendvai.name>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: 55659 <at> debbugs.gnu.org
Subject: Re: bug#55659: [PATCH 1/2] services: ddclient: Fix extra-options
 serialization.
Date: Fri, 17 Jun 2022 08:26:53 +0000
> Applied on current master 6fc33d91ba6b07beae8a9a38a5b768511bb79ced:
> --8<---------------cut here---------------start------------->8---
>
> oleg <at> guixsd ~/src/guix [env]$ ./pre-inst-env guix build ddclient
> gnu/packages/dns.scm:1113:44: In procedure native-inputs:
> error: perl-http-daemon-ssl: unbound variable
> hint: Did you forget a `use-modules' form?
> --8<---------------cut here---------------end--------------->8---
>
>
> Did you forget to attach a patch adding the perl-http-daemon-ssl?

forgot to say that this depends on https://issues.guix.gnu.org/55656

i was advised to split patchsets, but i think i really shouldn't have in this case.

sorry for the confusion, and thanks for testing it!

--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“Without love the acquisition of knowledge only increases confusion and leads to self-destruction.”
	— Jiddu Krishnamurti (1895–1986)





Information forwarded to guix-patches <at> gnu.org:
bug#55659; Package guix-patches. (Fri, 17 Jun 2022 08:54:01 GMT) Full text and rfc822 format available.

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

From: Attila Lendvai <attila <at> lendvai.name>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 55659 <at> debbugs.gnu.org
Subject: Re: bug#55659: [PATCH 1/2] services: ddclient: Fix extra-options
 serialization.
Date: Fri, 17 Jun 2022 08:53:01 +0000
> 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?


i agree, it's a much better, more intuitive name. i'll use it from now on.

(note that i'm not planning to work on this more. i hope someone will pick this up who actually uses ddclient, and therefore has the ability to test it with little effort. feel free to close it, too.)

--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“There is no leader, there is no teacher, there is nobody to tell you what to do. You are alone in this mad, brutal world.”
	— Jiddu Krishnamurti (1895–1986)





Added tag(s) wontfix. Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 03 Aug 2022 10:01:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 55659 <at> debbugs.gnu.org and Attila Lendvai <attila <at> lendvai.name> Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 03 Aug 2022 10:01:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 31 Aug 2022 11:24:10 GMT) Full text and rfc822 format available.

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

Previous Next


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