From 8fccb314365de5596b0fd4dae090c0c032056ab2 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 16 Feb 2022 15:29:35 +0100 Subject: [PATCH] linter: adjust the parsing to accommodate for a modern 'pyflakes' In version 2.2.0, pyflakes changed its output format, from 'filename:line: text' to 'filename:line:column text'. This fixes https://savannah.gnu.org/bugs/?62057. Problem existed since version 2.9.0, commit 5dcf375f. (That commit tried to compensate for an introductory message from gcc that no longer seems to exist.) --- src/text.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/text.c b/src/text.c index bb108aae..84beef4a 100644 --- a/src/text.c +++ b/src/text.c @@ -2652,10 +2652,9 @@ void do_linter(void) /* The recognized format is "filename:line:column: message", * where ":column" may be absent or be ",column" instead. */ - if (strstr(message, ": ") != NULL) { - filename = strtok(onelint, ":"); + if ((filename = strtok(onelint, ":")) != NULL) { if ((linestr = strtok(NULL, ":")) != NULL) { - if ((maybecol = strtok(NULL, ":")) != NULL) { + if ((maybecol = strtok(NULL, " ")) != NULL) { ssize_t tmplineno = 0, tmpcolno = 0; char *tmplinecol; @@ -2684,7 +2683,7 @@ void do_linter(void) curlint->prev = tmplint; if (curlint->prev != NULL) curlint->prev->next = curlint; - curlint->msg = copy_of(strstr(message, ": ") + 2); + curlint->msg = copy_of(strstr(message, " ") + 1); curlint->lineno = tmplineno; curlint->colno = tmpcolno; curlint->filename = copy_of(filename);