GNU bug report logs -
#53663
[PATCH] gnu: services: Also accept 'undefined in maybe-foo? constructs.
Previous Next
Reported by: Attila Lendvai <attila <at> lendvai.name>
Date: Mon, 31 Jan 2022 15:35:01 UTC
Severity: normal
Tags: patch
Done: Attila Lendvai <attila <at> lendvai.name>
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 53663 in the body.
You can then email your comments to 53663 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#53663
; Package
guix-patches
.
(Mon, 31 Jan 2022 15:35:01 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
.
(Mon, 31 Jan 2022 15:35:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
This is a temporary bandaid until a more explicit handling of maybe types is
introduced for configurations (e.g. by using srfi-189). Until then, with this
change it becomes possible to have definitions like:
(define-maybe string (no-serialization))
(define-configuration my-configuration
(my-field (maybe-string))
(no-serialization))
i.e. without providing a default value for MY-FIELD.
---
gnu/services/configuration.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index 0de350a4df..c5f276eab5 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -141,7 +141,9 @@ (define (define-maybe-helper serialize? prefix syn)
(id #'stem #'serialize-maybe- #'stem))))
#`(begin
(define (maybe-stem? val)
- (or (eq? val 'disabled) (stem? val)))
+ (or (eq? val 'disabled)
+ (eq? val 'undefined)
+ (stem? val)))
#,@(if serialize?
(list #'(define (serialize-maybe-stem field-name val)
(if (stem? val)
--
2.34.0
Information forwarded
to
guix-patches <at> gnu.org
:
bug#53663
; Package
guix-patches
.
(Tue, 01 Feb 2022 09:54:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 53663 <at> debbugs.gnu.org (full text, mbox):
Hi!
Attila Lendvai <attila <at> lendvai.name> skribis:
> This is a temporary bandaid until a more explicit handling of maybe types is
> introduced for configurations (e.g. by using srfi-189). Until then, with this
> change it becomes possible to have definitions like:
>
> (define-maybe string (no-serialization))
>
> (define-configuration my-configuration
> (my-field (maybe-string))
> (no-serialization))
>
> i.e. without providing a default value for MY-FIELD.
> ---
> gnu/services/configuration.scm | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
> index 0de350a4df..c5f276eab5 100644
> --- a/gnu/services/configuration.scm
> +++ b/gnu/services/configuration.scm
> @@ -141,7 +141,9 @@ (define (define-maybe-helper serialize? prefix syn)
> (id #'stem #'serialize-maybe- #'stem))))
> #`(begin
> (define (maybe-stem? val)
> - (or (eq? val 'disabled) (stem? val)))
> + (or (eq? val 'disabled)
> + (eq? val 'undefined)
> + (stem? val)))
My understanding is that 'disabled is here precisely to allow users to
not provide a value, in which case the generated configuration file will
not contain anything for that field.
What would be different here?
Thanks,
Ludo’.
Reply sent
to
Attila Lendvai <attila <at> lendvai.name>
:
You have taken responsibility.
(Wed, 02 Feb 2022 11:48:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Attila Lendvai <attila <at> lendvai.name>
:
bug acknowledged by developer.
(Wed, 02 Feb 2022 11:48:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 53663-close <at> debbugs.gnu.org (full text, mbox):
> What would be different here?
the possibility of writing:
(define-configuration my-cfg
(my-field (maybe-string)))
versus now having to write:
(define-configuration my-cfg
(my-field (maybe-string 'disabled)))
but now that i thought about it, i think everyone is better off if i
deal with this on my side, instead of having a discussion about the
exact shape of a bandaid.
closing this for now; more later in the form of a proper cleanup
proposal of the configuration code.
--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“There can be no greater stretch of arbitrary power than is required to seize children from their parents, teach them whatever the authorities decree they shall be taught, and expropriate from the parents the funds to pay for the procedure.”
— Isabel Paterson (1886–1961), 'The God of the Machine' (1943)
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 02 Mar 2022 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 168 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.