From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#49624: compilation message end-column function off-by-one bug Date: Sun, 18 Jul 2021 21:00:41 +0200 Message-ID: <462A3B1B-6632-4740-907D-03B67377452E@acm.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_516DFE37-6700-46E6-A593-4EECF868FE0F" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9968"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , Juri Linkov To: 49624@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 18 21:01:14 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m5C2L-0002RC-QF for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Jul 2021 21:01:13 +0200 Original-Received: from localhost ([::1]:34780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5C2K-00018d-Rt for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Jul 2021 15:01:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5C2A-00018T-Ud for bug-gnu-emacs@gnu.org; Sun, 18 Jul 2021 15:01:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45742) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5C2A-0006FZ-L6 for bug-gnu-emacs@gnu.org; Sun, 18 Jul 2021 15:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m5C2A-0006f8-CZ for bug-gnu-emacs@gnu.org; Sun, 18 Jul 2021 15:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Jul 2021 19:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49624 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.162663485625195 (code B ref -1); Sun, 18 Jul 2021 19:01:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Jul 2021 19:00:56 +0000 Original-Received: from localhost ([127.0.0.1]:57288 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5C24-0006Xy-00 for submit@debbugs.gnu.org; Sun, 18 Jul 2021 15:00:56 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:50514) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5C21-0006VN-HA for submit@debbugs.gnu.org; Sun, 18 Jul 2021 15:00:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5C21-00018K-8L for bug-gnu-emacs@gnu.org; Sun, 18 Jul 2021 15:00:53 -0400 Original-Received: from mail1435c50.megamailservers.eu ([91.136.14.35]:39356 helo=mail263c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5C1y-000647-BE for bug-gnu-emacs@gnu.org; Sun, 18 Jul 2021 15:00:52 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1626634844; bh=sKWMb2ADSEnIXXK8hgNgHWBREZw/cCHA2FthyP/be9I=; h=From:Subject:Date:Cc:To:From; b=bISQpHlk47kExlVOzSlEH2YdOjrE4CtxyPyLMT5TRGoS7jagIolIl9S5Kwk6m2Gf0 jD39Rf6dZoHkkFk5E4q0ffjtmYD5ptYhiLv1TrG6yTytS/U0/eOKSlV71Bq1gKvL47 wDxFUe4Os+uJL7JBBb6DtoC+7nHQgPghELQGY578= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail263c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 16IJ0fdP023241; Sun, 18 Jul 2021 19:00:43 +0000 X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F2A.60F47A5C.004D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=St3uF8G0 c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=M51BFTxLslgA:10 a=RC2J-Ho0QuaG6yQqrC8A:9 a=CjuIK1q_8ugA:10 a=cJY3XOdKWCUBERfyV3wA:9 a=B2y7HmGcmWMA:10 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.14.35; envelope-from=mattiase@acm.org; helo=mail263c50.megamailservers.eu X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:210203 Archived-At: --Apple-Mail=_516DFE37-6700-46E6-A593-4EECF868FE0F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Compilation message patterns (in compilation-regexp-alist and -alist) = can indicate starting and ending line and column numbers, either by = supplying regexp match numbers or functions that return the respective = line/column numbers when called. In other words, the integer N can be = understood as a shorthand for the function (lambda () (and (match-beginning N) (string-to-number (match-string = N)))) except that isn't true for the ending column where there is a difference = of 1; an END-COL function returning 13 means that the error's last = column is 12. There does not seem to be a good justification for this nor is it = documented so it's probably just a bug; proposed patch attached below. = Does it warrant a mention in etc/NEWS? --Apple-Mail=_516DFE37-6700-46E6-A593-4EECF868FE0F Content-Disposition: attachment; filename=0001-Fix-off-by-one-error-in-compilation-rule-end-column-.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Fix-off-by-one-error-in-compilation-rule-end-column-.patch" Content-Transfer-Encoding: quoted-printable =46rom=20a2303f4651e225115207bad778024f913dc6dacb=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Sun,=2018=20Jul=202021=2020:32:49=20+0200=0A= Subject:=20[PATCH]=20Fix=20off-by-one=20error=20in=20compilation=20rule=20= end-column=20function=0A=0A*=20lisp/progmodes/compile.el=20= (compilation-error-properties):=0AWhen=20the=20end-column=20parameter=20= of=20a=20compilation=20message=20rule=20is=0Aa=20function,=20treat=20its=20= return=20value=20the=20same=20way=20as=20textually=0Asupplied=20values=20= by=20adjusting=20both=20values=20in=20the=20same=20way.=0A---=0A=20= lisp/progmodes/compile.el=20=20=20=20=20=20=20=20=20=20=20=20|=2013=20= ++++++++-----=0A=20test/lisp/progmodes/compile-tests.el=20|=2027=20= +++++++++++++++++++++++++++=0A=202=20files=20changed,=2035=20= insertions(+),=205=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/progmodes/compile.el=20b/lisp/progmodes/compile.el=0Aindex=20= e4363e11b8..02d1c58858=20100644=0A---=20a/lisp/progmodes/compile.el=0A= +++=20b/lisp/progmodes/compile.el=0A@@=20-1248,11=20+1248,14=20@@=20= compilation-error-properties=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(setq=20col=20(match-string-no-properties=20col))=0A=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(string-to-number=20col))))=0A= =20=20=20=20=20(setq=20end-col=0A-=20=20=20=20=20=20=20=20=20=20(or=20= (if=20(functionp=20end-col)=20(funcall=20end-col)=0A-=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(and=20end-col=0A-=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(setq=20end-col=20= (match-string-no-properties=20end-col))=0A-=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(-=20(string-to-number=20end-col)=20= -1)))=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20(and=20end-line=20= -1)))=0A+=20=20=20=20=20=20=20=20=20=20(let=20((ec=20(if=20(functionp=20= end-col)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(funcall=20end-col)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(and=20end-col=20(match-beginning=20end-col)=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(string-to-number=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(match-string-no-properties=20= end-col))))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20(if=20ec=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(1+=20ec)=20=20=20=20=20;=20Add=20= one=20to=20get=20an=20exclusive=20upper=20bound.=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(and=20end-line=20-1))))=0A=20=20=20=20=20(if=20= (consp=20type)=20=20=20=20=20=20=20=20=20=20=20=20;=20not=20a=20static=20= type,=20check=20what=20it=20is.=0A=20=09(setq=20type=20(or=20(and=20(car=20= type)=20(match-end=20(car=20type))=201)=0A=20=09=09=20=20=20=20=20=20=20= (and=20(cdr=20type)=20(match-end=20(cdr=20type))=200)=0Adiff=20--git=20= a/test/lisp/progmodes/compile-tests.el=20= b/test/lisp/progmodes/compile-tests.el=0Aindex=200623cec528..2a3bb3dafa=20= 100644=0A---=20a/test/lisp/progmodes/compile-tests.el=0A+++=20= b/test/lisp/progmodes/compile-tests.el=0A@@=20-515,4=20+515,31=20@@=20= compile-test-grep-regexps=0A=20=20=20=20=20=20=20= (compile--test-error-line=20testcase))=0A=20=20=20=20=20(should=20(eq=20= compilation-num-errors-found=208))))=0A=20=0A+(ert-deftest=20= compile-test-functions=20()=0A+=20=20"Test=20rules=20using=20functions=20= instead=20of=20regexp=20group=20numbers."=0A+=20=20(let*=20((file-fun=20= (lambda=20()=20'("my-file")))=0A+=20=20=20=20=20=20=20=20=20= (line-start-fun=20(lambda=20()=20123))=0A+=20=20=20=20=20=20=20=20=20= (line-end-fun=20(lambda=20()=20134))=0A+=20=20=20=20=20=20=20=20=20= (col-start-fun=20(lambda=20()=2039))=0A+=20=20=20=20=20=20=20=20=20= (col-end-fun=20(lambda=20()=2024))=0A+=20=20=20=20=20=20=20=20=20= (compilation-error-regexp-alist-alist=0A+=20=20=20=20=20=20=20=20=20= `((my-rule=0A+=20=20=20=20=20=20=20=20=20=20=20=20,(rx=20bol=20"My=20= error=20message")=0A+=20=20=20=20=20=20=20=20=20=20=20=20,file-fun=0A+=20= =20=20=20=20=20=20=20=20=20=20=20(,line-start-fun=20.=20,line-end-fun)=0A= +=20=20=20=20=20=20=20=20=20=20=20=20(,col-start-fun=20.=20= ,col-end-fun))))=0A+=20=20=20=20=20=20=20=20=20= (compilation-error-regexp-alist=20'(my-rule)))=0A+=20=20= (with-temp-buffer=0A+=20=20=20=20(font-lock-mode=20-1)=0A+=20=20=20=20= (let=20((compilation-num-errors-found=200)=0A+=20=20=20=20=20=20=20=20=20= =20(compilation-num-warnings-found=200)=0A+=20=20=20=20=20=20=20=20=20=20= (compilation-num-infos-found=200))=0A+=20=20=20=20=20=20= (compile--test-error-line=0A+=20=20=20=20=20=20=20'(my-rule=0A+=20=20=20=20= =20=20=20=20=20"My=20error=20message"=0A+=20=20=20=20=20=20=20=20=201=20= (39=20.=2024)=20(123=20.=20134)=20"my-file"=202))=0A+=20=20=20=20=20=20= (should=20(eq=20compilation-num-errors-found=201))=0A+=20=20=20=20=20=20= (should=20(eq=20compilation-num-warnings-found=200))=0A+=20=20=20=20=20=20= (should=20(eq=20compilation-num-infos-found=200))))))=0A+=0A=20;;;=20= compile-tests.el=20ends=20here=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A=0A= --Apple-Mail=_516DFE37-6700-46E6-A593-4EECF868FE0F--