Add the / symbol to the sysctl parsing pattern
authorAlexander Popov <alex.popov@linux.com>
Sun, 13 Aug 2023 19:39:11 +0000 (22:39 +0300)
committerAlexander Popov <alex.popov@linux.com>
Sun, 13 Aug 2023 19:39:11 +0000 (22:39 +0300)
The GitHub Actions virtual machine has such a sysctl:
  fs.binfmt_misc.llvm-14-runtime/binfmt = enabled

This example shows that sysctl names may contain the / symbol.

kconfig_hardened_check/__init__.py

index 0502785b893b321796c6034720dad33df3b7d827..ee0babe223e0cc3977b2ac1ee29a1ce011fb32a8 100644 (file)
@@ -201,7 +201,7 @@ def parse_cmdline_file(mode, parsed_options, fname):
 
 def parse_sysctl_file(mode, parsed_options, fname):
     with open(fname, 'r', encoding='utf-8') as f:
-        sysctl_pattern = re.compile("[a-zA-Z0-9\._-]+ =.*$")
+        sysctl_pattern = re.compile("[a-zA-Z0-9/\._-]+ =.*$")
         for line in f.readlines():
             line = line.strip()
             if not sysctl_pattern.match(line):