]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
util: widen allowed characters in read_env_file 3914/head
authorJörg Behrmann <behrmann@physik.fu-berlin.de>
Wed, 24 Sep 2025 10:07:00 +0000 (12:07 +0200)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Wed, 24 Sep 2025 10:42:01 +0000 (12:42 +0200)
Currently we only read uppercase variables starting with a letter, but shell
variables only restriction is not starting with a number, so lowercase names
and names starting with an underscore are allowed.

mkosi/util.py

index 212dd8f55dfb4d8d62442d01cc7b1b4380e14941..53e0a08eb803f63d72f0313d2e5d2b4e4a8fc80e 100644 (file)
@@ -83,7 +83,7 @@ def read_env_file(path: PathString) -> Iterator[tuple[str, str]]:
             line = line.rstrip()
             if not line or line.startswith("#"):
                 continue
-            if m := re.match(r"([A-Z][A-Z_0-9]+)=(.*)", line):
+            if m := re.match(r"([a-zA-Z_][a-zA-Z_0-9]+)=(.*)", line):
                 name, val = m.groups()
                 if val and val[0] in "\"'":
                     val = ast.literal_eval(val)