GNU bug report logs - #51541
[PATCH] services: configuration: Fix interpose implementation.

Previous Next

Package: guix-patches;

Reported by: Andrew Tropin <andrew <at> trop.in>

Date: Mon, 1 Nov 2021 07:54:01 UTC

Severity: normal

Tags: patch

Done: Oleg Pykhalov <go.wigust <at> gmail.com>

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 51541 in the body.
You can then email your comments to 51541 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#51541; Package guix-patches. (Mon, 01 Nov 2021 07:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andrew Tropin <andrew <at> trop.in>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 01 Nov 2021 07:54:02 GMT) Full text and rfc822 format available.

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

From: Andrew Tropin <andrew <at> trop.in>
To: guix-patches <at> gnu.org, Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: [PATCH] services: configuration: Fix interpose implementation.
Date: Mon, 1 Nov 2021 10:43:12 +0300
[Message part 1 (text/plain, inline)]
* gnu/services/configuration.scm (interpose, serialize-text-config): Fix
interpose implementation, move file-like object code to
serialize-text-config.
---
This gexp reading file-like object content doesn't belong to interpose
function, moved that part of code out of it.

 gnu/services/configuration.scm | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index e8c55b6e4d..0de350a4df 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -359,10 +359,7 @@ (define* (interpose ls  #:optional (delimiter "\n") (grammar 'infix))
       (G_ "The GRAMMAR value must be 'infix or 'suffix, but ~a provided.")
       grammar)))
   (fold-right (lambda (e acc)
-                (cons #~(begin
-                          (use-modules (ice-9 rdelim))
-                          (with-fluids ((%default-port-encoding "UTF-8"))
-                            (with-input-from-file #$e read-string)))
+                (cons e
                       (if (and (null? acc) (eq? grammar 'infix))
                           acc
                           (cons delimiter acc))))
@@ -387,7 +384,16 @@ (define serialize-file-like empty-serializer)
 (define (text-config? config)
   (list-of file-like?))
 (define (serialize-text-config field-name val)
-  #~(string-append #$@(interpose val "\n" 'suffix)))
+  #~(string-append
+     #$@(interpose
+         (map
+          (lambda (e)
+            #~(begin
+                (use-modules (ice-9 rdelim))
+                (with-fluids ((%default-port-encoding "UTF-8"))
+                  (with-input-from-file #$e read-string))))
+          val)
+         "\n" 'suffix)))
 
 (define ((generic-serialize-alist-entry serialize-field) entry)
   "Apply the SERIALIZE-FIELD procedure on the field and value of ENTRY."
-- 
2.33.0

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

Reply sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
You have taken responsibility. (Mon, 01 Nov 2021 14:49:02 GMT) Full text and rfc822 format available.

Notification sent to Andrew Tropin <andrew <at> trop.in>:
bug acknowledged by developer. (Mon, 01 Nov 2021 14:49:02 GMT) Full text and rfc822 format available.

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

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Andrew Tropin <andrew <at> trop.in>
Cc: 51541-done <at> debbugs.gnu.org
Subject: Re: bug#51541: [PATCH] services: configuration: Fix interpose
 implementation.
Date: Mon, 01 Nov 2021 17:48:26 +0300
[Message part 1 (text/plain, inline)]
Hi Andrew,

Andrew Tropin <andrew <at> trop.in> writes:

> * gnu/services/configuration.scm (interpose, serialize-text-config): Fix
> interpose implementation, move file-like object code to
> serialize-text-config.
> ---
> This gexp reading file-like object content doesn't belong to interpose
> function, moved that part of code out of it.
>
>  gnu/services/configuration.scm | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)

Pushed to master.

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

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 30 Nov 2021 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 197 days ago.

Previous Next


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