* [bug#60707] [PATCH] gnu: services: Fix fail2ban configuration serialization.
@ 2023-01-10 10:11 muradm
2023-01-10 12:05 ` Bruno Victal
2023-01-10 14:47 ` [bug#60707] [PATCH v2] " muradm
0 siblings, 2 replies; 4+ messages in thread
From: muradm @ 2023-01-10 10:11 UTC (permalink / raw)
To: 60707; +Cc: maxim.cournoyer
This fixes a regression from 543d971ed2a1d9eb934af1f51930741d7cc4e7ef whereby
match-lambda due to configuration field reordering.
* gnu/services/security.scm:
[serialize-fail2ban-ignore-cache-configuration]: Remove first _ field.
[serialize-fail2ban-jail-filter-configuration]: Remove first _ field.
[serialize-fail2ban-jail-action-configuration]: Remove first _ field.
---
gnu/services/security.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gnu/services/security.scm b/gnu/services/security.scm
index 50111455fb..53b3914a4f 100644
--- a/gnu/services/security.scm
+++ b/gnu/services/security.scm
@@ -44,7 +44,7 @@ (define-configuration/no-serialization fail2ban-ignore-cache-configuration
(define serialize-fail2ban-ignore-cache-configuration
(match-lambda
- (($ <fail2ban-ignore-cache-configuration> _ key max-count max-time)
+ (($ <fail2ban-ignore-cache-configuration> key max-count max-time)
(format #f "key=\"~a\", max-count=~d, max-time=~d"
key max-count max-time))))
@@ -56,7 +56,7 @@ (define-configuration/no-serialization fail2ban-jail-filter-configuration
(define serialize-fail2ban-jail-filter-configuration
(match-lambda
- (($ <fail2ban-jail-filter-configuration> _ name mode)
+ (($ <fail2ban-jail-filter-configuration> name mode)
(format #f "~a~@[[mode=~a]~]" name (maybe-value mode)))))
(define (argument? a)
@@ -88,7 +88,7 @@ (define (serialize-fail2ban-jail-action-configuration-arguments args)
(define serialize-fail2ban-jail-action-configuration
(match-lambda
- (($ <fail2ban-jail-action-configuration> _ name arguments)
+ (($ <fail2ban-jail-action-configuration> name arguments)
(format
#f "~a~a"
name
--
2.38.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [bug#60707] [PATCH] gnu: services: Fix fail2ban configuration serialization.
2023-01-10 10:11 [bug#60707] [PATCH] gnu: services: Fix fail2ban configuration serialization muradm
@ 2023-01-10 12:05 ` Bruno Victal
2023-01-10 14:47 ` [bug#60707] [PATCH v2] " muradm
1 sibling, 0 replies; 4+ messages in thread
From: Bruno Victal @ 2023-01-10 12:05 UTC (permalink / raw)
To: 60707; +Cc: mail
You could refactor the code to use match-record instead.
It's easier to use and doesn't suffer from field reordering issues.
Cheers,
Bruno
^ permalink raw reply [flat|nested] 4+ messages in thread
* [bug#60707] [PATCH v2] gnu: services: Fix fail2ban configuration serialization.
2023-01-10 10:11 [bug#60707] [PATCH] gnu: services: Fix fail2ban configuration serialization muradm
2023-01-10 12:05 ` Bruno Victal
@ 2023-01-10 14:47 ` muradm
2023-01-10 16:00 ` bug#60707: [PATCH] " Maxim Cournoyer
1 sibling, 1 reply; 4+ messages in thread
From: muradm @ 2023-01-10 14:47 UTC (permalink / raw)
To: 60707
This fixes a regression from 543d971ed2a1d9eb934af1f51930741d7cc4e7ef whereby
match-lambda due to configuration field reordering.
* gnu/services/security.scm:
[serialize-fail2ban-ignore-cache-configuration]: Switch to match-record.
[serialize-fail2ban-jail-filter-configuration]: Switch to match-record.
[serialize-fail2ban-jail-action-configuration]: Switch to match-record.
---
gnu/services/security.scm | 40 +++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/gnu/services/security.scm b/gnu/services/security.scm
index 50111455fb..8116072920 100644
--- a/gnu/services/security.scm
+++ b/gnu/services/security.scm
@@ -42,11 +42,11 @@ (define-configuration/no-serialization fail2ban-ignore-cache-configuration
(max-count integer "Cache size.")
(max-time integer "Cache time."))
-(define serialize-fail2ban-ignore-cache-configuration
- (match-lambda
- (($ <fail2ban-ignore-cache-configuration> _ key max-count max-time)
- (format #f "key=\"~a\", max-count=~d, max-time=~d"
- key max-count max-time))))
+(define (serialize-fail2ban-ignore-cache-configuration config)
+ (match-record config <fail2ban-ignore-cache-configuration>
+ (key max-count max-time)
+ (format #f "key=\"~a\", max-count=~d, max-time=~d"
+ key max-count max-time)))
(define-maybe/no-serialization string)
@@ -54,10 +54,10 @@ (define-configuration/no-serialization fail2ban-jail-filter-configuration
(name string "Filter to use.")
(mode maybe-string "Mode for filter."))
-(define serialize-fail2ban-jail-filter-configuration
- (match-lambda
- (($ <fail2ban-jail-filter-configuration> _ name mode)
- (format #f "~a~@[[mode=~a]~]" name (maybe-value mode)))))
+(define (serialize-fail2ban-jail-filter-configuration config)
+ (match-record config <fail2ban-jail-filter-configuration>
+ (name mode)
+ (format #f "~a~@[[mode=~a]~]" name (maybe-value mode))))
(define (argument? a)
(and (pair? a)
@@ -86,17 +86,17 @@ (define (serialize-fail2ban-jail-action-configuration-arguments args)
(format #f "~a=~a" (car e) (any-value (cdr e))))))
(format #f "~a" (string-join (map key-value args) ","))))
-(define serialize-fail2ban-jail-action-configuration
- (match-lambda
- (($ <fail2ban-jail-action-configuration> _ name arguments)
- (format
- #f "~a~a"
- name
- (if (null? arguments) ""
- (format
- #f "[~a]"
- (serialize-fail2ban-jail-action-configuration-arguments
- arguments)))))))
+(define (serialize-fail2ban-jail-action-configuration config)
+ (match-record config <fail2ban-jail-action-configuration>
+ (name arguments)
+ (format
+ #f "~a~a"
+ name
+ (if (null? arguments) ""
+ (format
+ #f "[~a]"
+ (serialize-fail2ban-jail-action-configuration-arguments
+ arguments))))))
(define fail2ban-backend->string
(match-lambda
--
2.38.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#60707: [PATCH] gnu: services: Fix fail2ban configuration serialization.
2023-01-10 14:47 ` [bug#60707] [PATCH v2] " muradm
@ 2023-01-10 16:00 ` Maxim Cournoyer
0 siblings, 0 replies; 4+ messages in thread
From: Maxim Cournoyer @ 2023-01-10 16:00 UTC (permalink / raw)
To: muradm; +Cc: 60707-done, mirai
Hi!
(Please make sure to keep all participants such as Bruno in '--cc' in
the fututer to make it more likely they see your v2!)
muradm <mail@muradm.net> writes:
> This fixes a regression from 543d971ed2a1d9eb934af1f51930741d7cc4e7ef whereby
> match-lambda due to configuration field reordering.
>
> * gnu/services/security.scm:
> [serialize-fail2ban-ignore-cache-configuration]: Switch to match-record.
> [serialize-fail2ban-jail-filter-configuration]: Switch to match-record.
> [serialize-fail2ban-jail-action-configuration]: Switch to match-record.
LGTM. Thanks to Bruno for the suggestion to use match-record.
Applied as dc403ec7f1.
--
Thanks,
Maxim
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-01-10 16:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-10 10:11 [bug#60707] [PATCH] gnu: services: Fix fail2ban configuration serialization muradm
2023-01-10 12:05 ` Bruno Victal
2023-01-10 14:47 ` [bug#60707] [PATCH v2] " muradm
2023-01-10 16:00 ` bug#60707: [PATCH] " Maxim Cournoyer
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).