From: Alexander Popov Date: Sat, 9 Mar 2024 17:24:07 +0000 (+0300) Subject: Skip the kernel version part after '-' X-Git-Tag: v0.6.10~106 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=03863c01dccde72aefe8f4561c744af52710190a;p=kconfig-hardened-check.git Skip the kernel version part after '-' Example: # Linux/x86_64 6.7.4-200.fc39.x86_64 Kernel Configuration Refers to #88, #89, #97 --- diff --git a/kernel_hardening_checker/__init__.py b/kernel_hardening_checker/__init__.py index 2fa789d..4855a59 100644 --- a/kernel_hardening_checker/__init__.py +++ b/kernel_hardening_checker/__init__.py @@ -53,7 +53,7 @@ def detect_kernel_version(fname): if ver_pattern.match(line): line = line.strip() parts = line.split() - ver_str = parts[2] + ver_str = parts[2].split('-', 1)[0] ver_numbers = ver_str.split('.') if len(ver_numbers) < 3 or not ver_numbers[0].isdigit() or not ver_numbers[1].isdigit(): msg = f'failed to parse the version "{ver_str}"'