From 75041d550568db5c265fe6bf693d5bc10ab0d4d3 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Sat, 14 Feb 2026 20:36:27 +0100 Subject: [PATCH] src/python/jw/pkg/cmds/CmdDistro: Fix ID regex The ID regex on /etc/os-release also matches ID_LIKE, which is obviously nonsense. Fix that. Signed-off-by: Jan Lindemann --- src/python/jw/pkg/cmds/CmdDistro.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/python/jw/pkg/cmds/CmdDistro.py b/src/python/jw/pkg/cmds/CmdDistro.py index 678fb4f9..c471ea20 100644 --- a/src/python/jw/pkg/cmds/CmdDistro.py +++ b/src/python/jw/pkg/cmds/CmdDistro.py @@ -22,10 +22,10 @@ class CmdDistro(CmdBase): # export else: os_release = '/etc/os-release' with open(os_release, 'r') as file: - matches = re.findall(r'^ID="?([^"]+)"?$', file.read(), re.MULTILINE) - if len(matches) != 1: + m = re.search(r'^\s*ID\s*=\s*("?)([^"\n]+)\1\s*$', file.read(), re.MULTILINE) + if m is None: raise Exception(f'Could not read "ID=" from "{os_release}"') - self.__id = matches[0] + self.__id = m.group(2) return self.__id def add_arguments(self, p: ArgumentParser) -> None: