2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 18:17:09 +00:00

simplify mount_condition_pattern

The whole pattern already has `(...)*`, therefore there's no need to
make option_pattern optional.

Before this change, mount_condition_pattern could have matched
- on empty strings (it still can, thanks to the trailing `*` which can
  also mean "zero matches") or
- whitespace-only strings (which is covered by the two regexes using
  mount_condition_pattern - they both have `\s*` and/or `\s+` around it)
This commit is contained in:
Christian Boltz 2025-06-04 19:32:25 +02:00
parent 23deb55149
commit d223751de0
No known key found for this signature in database
GPG Key ID: C6A682EA63C82F1C

View File

@ -58,7 +58,7 @@ option_pattern = r'\s*(\boption(s?)\b\s*(?P<options_equals_or_in>=|in)\s*'\
# allow any order of fstype and options
# Note: also matches if multiple fstype= or options= are given to keep the regex simpler
mount_condition_pattern = rf'({fs_type_pattern}\s*|{option_pattern}?\s*)*'
mount_condition_pattern = rf'({fs_type_pattern}\s*|{option_pattern}\s*)*'
# Source can either be
# - A path : /foo