From 8e612038debed5c5c30df15e97163437f59a1e35 Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Sun, 22 Dec 2019 16:53:05 +0100 Subject: [PATCH] testing/check_fc_files: allow @ character in file context patterns Some systemd units use @ in their names. Fixes: https://github.com/SELinuxProject/refpolicy/issues/131 Signed-off-by: Nicolas Iooss --- testing/check_fc_files.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/check_fc_files.py b/testing/check_fc_files.py index c7ed7e367..899308173 100755 --- a/testing/check_fc_files.py +++ b/testing/check_fc_files.py @@ -152,7 +152,7 @@ def analyze_fc_file(fc_path): reduced_path = reduced_path.replace("include`'(", 'include(') # Check the character set of the path - invalid_characters = set(re.findall(r'[^-0-9A-Za-z_./()?+*%{}\[\]^|:~\\]', reduced_path)) + invalid_characters = set(re.findall(r'[^-0-9A-Za-z_@./()?+*%{}\[\]^|:~\\]', reduced_path)) if invalid_characters: print(f"{prefix}unexpected characters {' '.join(sorted(invalid_characters))} in {path}") retval = False @@ -271,7 +271,7 @@ def analyze_fc_file(fc_path): # Check the remaining symbols in the reduced path. # Only show a warning if no other ones were reported, in order to reduce the probability of false-positive. - invalid_symbols = set(re.findall(r'[^-0-9A-Za-z_~:ᠰ/]', reduced_path)) + invalid_symbols = set(re.findall(r'[^-0-9A-Za-z_@~:ᠰ/]', reduced_path)) if retval and invalid_symbols: print(f"{prefix}unexpected symbols {' '.join(sorted(invalid_symbols))} in {path} after being reduced to {reduced_path}. This could be due to an error in the pattern or a missing reduction rule in the checker") # noqa retval = False