GNU bug report logs -
#51541
[PATCH] services: configuration: Fix interpose implementation.
Previous Next
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.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Mon, 01 Nov 2021 17:48:26 +0300
with message-id <874k8wkk3p.fsf <at> gmail.com>
and subject line Re: bug#51541: [PATCH] services: configuration: Fix interpose implementation.
has caused the debbugs.gnu.org bug report #51541,
regarding [PATCH] services: configuration: Fix interpose implementation.
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
51541: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=51541
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (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)]
[Message part 5 (message/rfc822, inline)]
[Message part 6 (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)]
This bug report was last modified 3 years and 198 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.