From: Franck Bui Date: Fri, 23 Feb 2018 16:12:50 +0000 (+0100) Subject: rule-syntax-check: values can contain escaped double quotes X-Git-Tag: v238~44^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=75a56cb63259505e568d0524461d446040ceba6c;p=thirdparty%2Fsystemd.git rule-syntax-check: values can contain escaped double quotes This is true since commit 7e760b79ad143b26a5c937afa7666a7c40508f85. Note that the changes in the regex expressions relies on the fact that the script assumes that the comma separator is mandatory. Add a comment in the script to clarify this. --- diff --git a/test/rule-syntax-check.py b/test/rule-syntax-check.py index f24285ddac6..dcbab5fc6dc 100755 --- a/test/rule-syntax-check.py +++ b/test/rule-syntax-check.py @@ -28,10 +28,10 @@ rules_files = sys.argv[1:] if not rules_files: sys.exit('Specify files to test as arguments') -no_args_tests = re.compile(r'(ACTION|DEVPATH|KERNELS?|NAME|SYMLINK|SUBSYSTEMS?|DRIVERS?|TAG|PROGRAM|RESULT|TEST)\s*(?:=|!)=\s*"([^"]*)"$') -args_tests = re.compile(r'(ATTRS?|ENV|TEST){([a-zA-Z0-9/_.*%-]+)}\s*(?:=|!)=\s*"([^"]*)"$') -no_args_assign = re.compile(r'(NAME|SYMLINK|OWNER|GROUP|MODE|TAG|RUN|LABEL|GOTO|OPTIONS|IMPORT)\s*(?:\+=|:=|=)\s*"([^"]*)"$') -args_assign = re.compile(r'(ATTR|ENV|IMPORT|RUN){([a-zA-Z0-9/_.*%-]+)}\s*(=|\+=)\s*"([^"]*)"$') +no_args_tests = re.compile(r'(ACTION|DEVPATH|KERNELS?|NAME|SYMLINK|SUBSYSTEMS?|DRIVERS?|TAG|PROGRAM|RESULT|TEST)\s*(?:=|!)=\s*"(.*)"$') +args_tests = re.compile(r'(ATTRS?|ENV|TEST){([a-zA-Z0-9/_.*%-]+)}\s*(?:=|!)=\s*"(.*)"$') +no_args_assign = re.compile(r'(NAME|SYMLINK|OWNER|GROUP|MODE|TAG|RUN|LABEL|GOTO|OPTIONS|IMPORT)\s*(?:\+=|:=|=)\s*"(.*)"$') +args_assign = re.compile(r'(ATTR|ENV|IMPORT|RUN){([a-zA-Z0-9/_.*%-]+)}\s*(=|\+=)\s*"(.*)"$') result = 0 buffer = '' @@ -54,6 +54,8 @@ for path in rules_files: if not line or line.startswith('#'): continue + # Separator ',' is normally optional but we make it mandatory here as + # it generally improves the readability of the rules. for clause in line.split(','): clause = clause.strip() if not (no_args_tests.match(clause) or args_tests.match(clause) or