]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
man/check-os-release.py: strip trailing whitespace 19686/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 21 May 2021 13:02:23 +0000 (15:02 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 22 May 2021 10:20:51 +0000 (12:20 +0200)
The shell parser would do that, so so should we.

man/check-os-release.py

index f6d23c8c463d3678ba27446e31c332ee12660b36..069ca74b20e636bb937b088da689c06b140a9a4e 100644 (file)
@@ -10,7 +10,7 @@ def read_os_release():
         f = open('/usr/lib/os-release')
 
     for line_number, line in enumerate(f):
-        if m := re.match(r'([A-Z][A-Z_0-9]+)=(.*)', line):
+        if m := re.match(r'([A-Z][A-Z_0-9]+)=(.*?)\s*$', line):
             name, val = m.groups()
             if val and val[0] in '"\'':
                 val = ast.literal_eval(val)