From e4df6203e27fbb4458fda21f029f90a114465c1a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mattias=20Engdeg=C3=A5rd?= Date: Wed, 29 Jun 2022 17:18:04 +0200 Subject: [PATCH] More robust `gnu` pattern (bug#56249) * lisp/progmodes/compile.el (compilation-error-regexp-alist-alist): Don't allow spaces in the file names, to avoid false matches. Don't allow ad-hoc spaces preceding the program name either. --- lisp/progmodes/compile.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 3393aa9b635..db57093559d 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -368,17 +368,18 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) ;; Match an optional program name which is used for ;; non-interactive programs other than compilers (e.g. the ;; "jade:" entry in compilation.txt). - (? (: (* " ") ; Allow space to precede the program name. - (| (: alpha (+ (in ?. ?- alnum)) ":" (? " ")) - ;; Skip indentation generated by GCC's -fanalyzer. - (: (+ " ") "|")))) + (? (| (: alpha (+ (in ?. ?- alnum)) ":" (? " ")) + ;; Skip indentation generated by GCC's -fanalyzer. + (: (+ " ") "|"))) ;; File name group. (group-n 1 ;; Avoid matching the file name as a program in the pattern ;; above by disallowing file names entirely composed of digits. - (* (in "0-9")) - (not (in "0-9" "\n")) + ;; Do not allow file names beginning with a space. + (| (not (in "0-9" "\n\t ")) + (: (+ (in "0-9")) + (not (in "0-9" "\n")))) ;; A file name can be composed of any non-newline char, but ;; rule out some valid but unlikely cases, such as a trailing ;; space or a space followed by a -, or a colon followed by a -- 2.39.5