]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Reset default values when assigning the empty string to list setting
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 8 Jan 2024 16:38:11 +0000 (17:38 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 8 Jan 2024 17:57:54 +0000 (18:57 +0100)
For list based settings, it makes more sense for the empty string
to get rid of any default value as well.

NEWS.md
mkosi/config.py
mkosi/resources/mkosi.md

diff --git a/NEWS.md b/NEWS.md
index d34e565d9d467dce10895a2a93d1574481d2b987..df02819f6c38b4c9c883bdcd3ce37e1c671d4944 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,8 @@
 
 ## v20
 
+- Assigning the empty string to a setting that takes a list of values
+  now overrides any configured default value as well.
 - The github action does not build and install systemd from source
   anymore. Instead, `ToolsTree=default` can be used to make sure a
   recent version of systemd is used to do the image build.
index 7834a6073d3ac539b401dcb6212a813d88bb0ab5..442c96a664918e2a88c9cff397c01124e879da5b 100644 (file)
@@ -636,7 +636,7 @@ def config_make_list_parser(delimiter: str,
 
         # Empty strings reset the list.
         if reset and len(values) == 1 and values[0] == "":
-            return None
+            return []
 
         return new + [parse(v) for v in values if v]
 
index 2fd346f59111580e1811fc67b27c956a6c1f4a71..76bc2ee141eb01dbf14a52a516b89cdf963e4184 100644 (file)
@@ -303,7 +303,8 @@ the earlier assignment would be used instead of later assignments.
 
 Settings that take a list of values are merged by appending the new
 values to the previously configured values. Assigning the empty string
-to such a setting removes all previously assigned values.
+to such a setting removes all previously assigned values, and overrides
+any configured default values as well.
 
 If a setting's name in the configuration file is prefixed with `@`, it
 configures the default value used for that setting if no explicit