From: Andrew Tropin <andrew@trop.in>
To: 51541@debbugs.gnu.org, go.wigust@gmail.com
Subject: [bug#51541] [PATCH] services: configuration: Fix interpose implementation.
Date: Mon, 1 Nov 2021 10:43:12 +0300 [thread overview]
Message-ID: <875ytctiq2.fsf@trop.in> (raw)
[-- Attachment #1: Type: text/plain, Size: 1928 bytes --]
* 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next reply other threads:[~2021-11-01 7:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-01 7:43 Andrew Tropin [this message]
2021-11-01 14:48 ` bug#51541: [PATCH] services: configuration: Fix interpose implementation Oleg Pykhalov
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875ytctiq2.fsf@trop.in \
--to=andrew@trop.in \
--cc=51541@debbugs.gnu.org \
--cc=go.wigust@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).