[systemd-devel] [PATCH] parse_boolean: require exact matches

Ansgar Burchardt ansgar at debian.org
Mon Aug 4 14:59:36 PDT 2014


Lennart Poettering <lennart at poettering.net> writes:
> On Sun, 27.07.14 15:19, Ansgar Burchardt (ansgar at debian.org) wrote:
>> Require exact matches in all cases instead of treating strings
>> starting with 't' ('f') as true (false).
>> 
>> This is required for config_parse_protect_system to parse ProtectSystem=full
>> correctly: it uses parse_boolean and only tries a more specific parsing
>> function if that did not return a valid result. Thus "full" was treated as
>> "false" before.
>
> Hmm, that sounds as if we also should change the order in which we parse
> the string, no? I mean, first try to parse it as native enum, and only
> if that doesn't work parse it as boolean?

The order should not matter as long as the allowed values for
ProtectSystem and similar options stays a superset of those for
booleans.

Changing just the order instead of requiring exact matches in
parse_boolean would not be so nice: a mistyped 'fill' instead of 'full'
would silently be parsed as 'false' instead of giving an error.

Ansgar


More information about the systemd-devel mailing list