From 9495d2f2bd025949b27d030cded751cfb0392cdc Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Tue, 2 Apr 2013 14:38:18 +0200 Subject: [PATCH] check-news: fix behavior on invalid date line Before: $ ./autotools/check-news < ./NEWS Traceback (most recent call last): File "./autotools/check-news", line 150, in <module> main() File "./autotools/check-news", line 120, in main parsed_ts = time.mktime(time.strptime(m.group("date"), "%d %b %Y")) AttributeError: 'NoneType' object has no attribute 'group' After: $ ./autotools/check-news < ./NEWS Line 8: Invalid release line This happened because the error function just updates an error log, rather than bailing out immediately. Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Michele Tartara <mtartara@google.com> --- autotools/check-news | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autotools/check-news b/autotools/check-news index 146faf2ea..cb5ac9a41 100755 --- a/autotools/check-news +++ b/autotools/check-news @@ -113,6 +113,8 @@ def main(): m = RELEASED_RE.match(line) if not m: Error("Line %s: Invalid release line" % fileinput.filelineno()) + expect_date = False + continue # Including the weekday in the date string does not work as time.strptime # would return an inconsistent result if the weekday is incorrect. -- GitLab