From e111f7c9355acc0fc16dd1dcb3c9e0cc6a00f263 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Wed, 12 Sep 2018 13:23:22 +0200 Subject: [PATCH] Detect bogus task tags Signed-off-by: Clifford Wolf --- sbysrc/sby.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sbysrc/sby.py b/sbysrc/sby.py index 5f33e1d..efc8b1a 100644 --- a/sbysrc/sby.py +++ b/sbysrc/sby.py @@ -139,7 +139,9 @@ def read_sbyconfig(sbydata, taskname): task_skiping_blocks = False continue + found_task_tag = False task_skip_line = False + for t in task_tags_all: if line.startswith(t+":"): line = line[len(t)+1:].lstrip() @@ -157,8 +159,15 @@ def read_sbyconfig(sbydata, taskname): else: task_skip_line = not match + found_task_tag = True break + if len(task_tags_all) and not found_task_tag: + tokens = line.split() + if len(tokens) > 0 and tokens[0].endswith(":"): + print("ERROR: Invalid task specifier \"%s\"." % tokens[0], file=sys.stderr) + sys.exit(1) + if task_skip_line or task_skip_block: continue -- 2.30.2