[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#56799: (gnu services configuration) usage of *unspecified* is proble
From: |
Attila Lendvai |
Subject: |
bug#56799: (gnu services configuration) usage of *unspecified* is problematic |
Date: |
Thu, 11 Aug 2022 10:15:43 +0000 |
> OK, I've reread this, and it is indeed a risk, that 'unset could leak in
> the case of a serializable configuration making use of a maybe-value
> field of type maybe-symbol. I've added the unit test suggested as
> 97cb43e732a38758c95b7caf3963507188d011cf (currently marked as 'expected
> to fail'). Luckily no current service uses that.
thank you for that Maxim!
and sorry for my initial, somewhat reactive, and emotionally driven response
earlier! maintaining a channel with complex services, and finally getting the
changes i needed merged into Guix proper was a source of frustration for me.
i've looked at the current state of the code, and it looks good to me. the only
issues i have left are the following:
1) the (eq 'unset ...) scattered around the code; it should be hidden behind an
explicit abstraction, but you yourself mentioned this already in an earlier
mail. i'd call it CONFIGURATION-FIELD-SET? (instead of MAYBE-SET?). it's
longer, but we have completion in emacs, and it won't be used a gazillion times
all around the code either.
2) the lack of an abstraction for the unset/unspecified value. whatever we use
as the marker should be hidden behind either an exported global variable, or a
function called UNSET-CONFIGURATION-FIELD! (or something alike). i should have
introduced these myself, and then your fix would have been as simple as
replacing *UNSPECIFIED* with 'UNSET in the abstraction.
3) the SYMBOL? corner case that your test captures, but it's not a burning
issue for me (it doesn't affect the user facing API, once the above leakages
are fixed).
do you agree? if yes, will you implement it, or shall i prepare a patch?
one more note: sometimes it's useful to have a field with a maybe type that
also has a default, together with the ability to explicitly unset this field.
an example would be a port specification for a torrent client: it has some
default port, but it's possible to explicitly unset the port value to request
the allocation of a random port at startup.
to better accommodate for this use case, 2) should probably be implemented not
as an UNSET-FOO! function, but as a global variable holding the unset value
marker. or maybe both?
--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“There is only one thing more harmful to society than an elected official
forgetting the promises he made in order to get elected; that's when he doesn't
forget them.”
— John McCarthy (1927–2011), father of Lisp
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, (continued)
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Maxim Cournoyer, 2022/08/01
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Ludovic Courtès, 2022/08/02
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, bokr, 2022/08/02
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Maxim Cournoyer, 2022/08/02
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Ludovic Courtès, 2022/08/04
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Ludovic Courtès, 2022/08/07
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Attila Lendvai, 2022/08/08
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Attila Lendvai, 2022/08/08
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Maxim Cournoyer, 2022/08/09
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Maxim Cournoyer, 2022/08/09
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic,
Attila Lendvai <=
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Maxim Cournoyer, 2022/08/13
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Attila Lendvai, 2022/08/13
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Maxim Cournoyer, 2022/08/13
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Attila Lendvai, 2022/08/16
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Maxim Cournoyer, 2022/08/17
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, (, 2022/08/17
- bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Maxim Cournoyer, 2022/08/09
bug#56799: (gnu services configuration) usage of *unspecified* is problematic, Maxim Cournoyer, 2022/08/01