Perform basic sanity checking when reading hints files

The only test currently implemented is to ensure that any prospective
hint contains at least one item beyond the hint name.  This prevents
lines in a hint file consisting simply of e.g. "easy" being added to
the hint list and causing later processing to abort with an error.

Signed-off-by: Adam D. Barratt <adam@adam-barratt.org.uk>
This commit is contained in:
Adam D. Barratt 2012-04-01 22:46:05 +00:00
parent c992787918
commit 8ee72661f0

View File

@ -813,6 +813,9 @@ class Britney(object):
break
elif l[0] not in self.HINTS[who]:
continue
elif len(l) == 1:
# All current hints require at least one argument
self.__log("Malformed hint found in %s: '%s'" % (filename, line), type="W")
elif l[0] in ["approve", "block", "block-all", "block-udeb", "unblock", "unblock-udeb", "force", "urgent", "remove"]:
for package in l[1:]:
hints.add_hint('%s %s' % (l[0], package), who)