Detect bogus task tags
authorClifford Wolf <clifford@clifford.at>
Wed, 12 Sep 2018 11:23:22 +0000 (13:23 +0200)
committerClifford Wolf <clifford@clifford.at>
Wed, 12 Sep 2018 11:23:34 +0000 (13:23 +0200)
Signed-off-by: Clifford Wolf <clifford@clifford.at>
sbysrc/sby.py

index 5f33e1d42b02670e0687526c9728d8df7484229e..efc8b1a28e82ce3e5cb1e9a0ec8a0ebac58c683d 100644 (file)
@@ -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