]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
config: right strip newlines from contents read via path_read_text
authorJoerg Behrmann <behrmann@physik.fu-berlin.de>
Thu, 2 Nov 2023 21:19:49 +0000 (22:19 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 3 Nov 2023 19:42:52 +0000 (20:42 +0100)
This so far only affects mkosi.version and mkosi.rootpw.

Fixes: 2031
mkosi/config.py

index b1612dbc74c1390cb63aa8c430b787c0a7ebf7ef..82b3b159463e19cd8540e6c9723b8882630d7a83 100644 (file)
@@ -2318,8 +2318,11 @@ def parse_config(argv: Sequence[str] = ()) -> tuple[MkosiArgs, tuple[MkosiConfig
                         expandvars=False,
                     )
                     if p.exists():
-                        setattr(ns, s.dest,
-                                s.parse(p.read_text() if s.path_read_text else f, getattr(ns, s.dest, None)))
+                        setattr(
+                            ns,
+                            s.dest,
+                            s.parse(p.read_text().rstrip("\n") if s.path_read_text else f, getattr(ns, s.dest, None)),
+                        )
 
         if path.exists():
             logging.debug(f"Including configuration file {Path.cwd() / path}")