From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: Scan of Emacs regexp mistakes Date: Thu, 16 Apr 2020 12:37:06 +0200 Message-ID: References: <140DB045-4529-4862-99B8-5F0DEF1EE8D4@acm.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_A03DEBE3-B92F-4624-8ECC-EE2F9C4079C6" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="128861"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 16 12:37:49 2020 Return-path: Envelope-to: ged-emacs-devel@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 1jP1ty-000XLR-ER for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Apr 2020 12:37:46 +0200 Original-Received: from localhost ([::1]:60500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jP1tx-0000Pe-GX for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Apr 2020 06:37:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37008) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jP1tS-0008Qq-GO for emacs-devel@gnu.org; Thu, 16 Apr 2020 06:37:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jP1tR-0007ks-2Q for emacs-devel@gnu.org; Thu, 16 Apr 2020 06:37:14 -0400 Original-Received: from mail1475c50.megamailservers.eu ([91.136.14.75]:46124 helo=mail118c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jP1tQ-0007ht-G3 for emacs-devel@gnu.org; Thu, 16 Apr 2020 06:37:13 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1587033428; bh=VYF4tz8XtSN0GZPyH49Jof0Zzn5blEdKwNnCTWuh58w=; h=From:Subject:Date:References:To:In-Reply-To:From; b=qyJ11uuFXYNkGiQUeVID7kKhmXIr6KoO7faUc11P+1VlPbsbQz0APDpIfJ7NTMTQ7 EO8eeLb/ihMNsJgzwWCz395E6UtCmbjkvXRKQgBeuVYWLeBTriyswL9h2GDAw9JS4N e9wiU4Owtep9iLyjsEpka6ubopT8jBjpE8tPL4sc= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail118c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 03GAb6hN026238 for ; Thu, 16 Apr 2020 10:37:08 +0000 In-Reply-To: <140DB045-4529-4862-99B8-5F0DEF1EE8D4@acm.org> X-Mailer: Apple Mail (2.3445.104.14) X-CTCH-RefID: str=0001.0A782F26.5E983525.0061, 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=KaGsTjQD c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=M51BFTxLslgA:10 a=1HojDRXGifTnGfESVCgA:9 a=QEXdDO2ut3YA:10 a=zmDKzeJbIzl36zFrPjEA:9 a=B2y7HmGcmWMA:10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 91.136.14.75 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:247081 Archived-At: --Apple-Mail=_A03DEBE3-B92F-4624-8ECC-EE2F9C4079C6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 The remaining regexp glitches found by the latest sweep were fixed by = the attached patch (now on master), except tramp-adb-prompt: lisp/net/tramp-adb.el:59:56: In tramp-adb-prompt: Repetition subsumes = preceding repetition (pos 50) = "^[[:digit:]]*|?[[:alnum:]\e;[]*@?[[:alnum:]]*[^#\\$]*[#\\$][[:space:]]" ....................................................^ I think it should be "^[^#$\n]*[#$] ", but hold out for some assistance = from the author (J=C3=BCrgen H=C3=B6tzel, contacted). --Apple-Mail=_A03DEBE3-B92F-4624-8ECC-EE2F9C4079C6 Content-Disposition: attachment; filename=0001-Fix-bugs-inefficiencies-and-bad-style-in-regexps.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Fix-bugs-inefficiencies-and-bad-style-in-regexps.patch" Content-Transfer-Encoding: quoted-printable =46rom=20905c0a13f7929298cb36151f46dbef03f7bdcbe4=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Thu,=2016=20Apr=202020=2011:04:24=20+0200=0A= Subject:=20[PATCH]=20Fix=20bugs,=20inefficiencies=20and=20bad=20style=20= in=20regexps=0A=0AFound=20by=20relint.=20=20See=20discussion=20at=0A= https://lists.gnu.org/archive/html/emacs-devel/2020-04/msg00265.html=0A=0A= *=20lisp/org/org-table.el=20(org-table-finish-edit-field):=0A*=20= lisp/arc-mode.el=20(archive-rar-summarize):=0AAvoid=20wrapped=20= subsumption=20in=20repeated=20sequences.=0A*=20lisp/erc/erc-dcc.el=20= (erc-dcc-ctcp-query-send-regexp):=20Replace=0Ainefficient=20repeated=20= empty-matching=20expression=20with=20a=20plain=20greedy=0Aform.=0A= (erc-dcc-handle-ctcp-send):=20Adjust=20group=20numbers.=0A*=20= lisp/net/puny.el=20(puny-encode-domain):=20Fix=20fast-path=20shortcut=0A= pattern=20so=20that=20it=20actually=20works=20as=20intended.=0A*=20= lisp/progmodes/gdb-mi.el=20(gdb-control-commands-regexp):=0A*=20= lisp/vc/diff-mode.el=20(diff-imenu-generic-expression):=0ARemove=20= superfluous=20backslashes.=0A*=20lisp/progmodes/scheme.el=20= (scheme-imenu-generic-expression):=0ACorrect=20confused=20= definition-matching=20pattern=20which=20would=20match=20more=0Athan=20= intended.=0A*=20lisp/textmodes/sgml-mode.el=20(sgml-tag-name-re):=20= Avoid=20inefficient=0Amatching=20by=20using=20the=20fact=20that=20the=20= first=20character=20cannot=20match=20the=0Alast=20char=20of=20= sgml-name-re.=0A---=0A=20lisp/arc-mode.el=20=20=20=20=20=20=20=20=20=20=20= =20|=20=202=20+-=0A=20lisp/erc/erc-dcc.el=20=20=20=20=20=20=20=20=20|=20= 14=20+++++++-------=0A=20lisp/net/puny.el=20=20=20=20=20=20=20=20=20=20=20= =20|=20=202=20+-=0A=20lisp/org/org-table.el=20=20=20=20=20=20=20|=20=202=20= +-=0A=20lisp/progmodes/gdb-mi.el=20=20=20=20|=20=202=20+-=0A=20= lisp/progmodes/scheme.el=20=20=20=20|=20=202=20+-=0A=20= lisp/textmodes/sgml-mode.el=20|=20=205=20++++-=0A=20lisp/vc/diff-mode.el=20= =20=20=20=20=20=20=20|=20=202=20+-=0A=208=20files=20changed,=2017=20= insertions(+),=2014=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/arc-mode.el=20b/lisp/arc-mode.el=0Aindex=204d36667969..c918f06c80=20= 100644=0A---=20a/lisp/arc-mode.el=0A+++=20b/lisp/arc-mode.el=0A@@=20= -2032,7=20+2032,7=20@@=20archive-rar-summarize=0A=20=20=20=20=20=20=20=20= =20=20=20(call-process=20"lsar"=20nil=20t=20nil=20"-l"=20(or=20file=20= copy))=0A=20=20=20=20=20=20=20=20=20(if=20copy=20(delete-file=20copy)))=0A= =20=20=20=20=20=20=20(goto-char=20(point-min))=0A-=20=20=20=20=20=20= (re-search-forward=20"^\\(\s+=3D+\s*\\)+\n")=0A+=20=20=20=20=20=20= (re-search-forward=20"^\\(?:\s+=3D+\\)+\s*\n")=0A=20=20=20=20=20=20=20= (while=20(looking-at=20(concat=20"^\s+[0-9.]+\s+D?-+\s+"=20=20=20;=20= Flags=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=20=20=20=20=20=20"\\([0-9-]+\\)\s+"=20=20=20=20=20=20=20= =20;=20Size=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=20=20=20=20=20=20"\\([-0-9.]+\\)%?\s+"=20=20=20=20= =20=20;=20Ratio=0Adiff=20--git=20a/lisp/erc/erc-dcc.el=20= b/lisp/erc/erc-dcc.el=0Aindex=2026701cec1e..8ccceec459=20100644=0A---=20= a/lisp/erc/erc-dcc.el=0A+++=20b/lisp/erc/erc-dcc.el=0A@@=20-627,11=20= +627,11=20@@=20erc-ctcp-query-DCC=0A=20=20=20=20=20=20=20=20?q=20query=20= ?n=20nick=20?u=20login=20?h=20host))))=0A=20=0A=20(defconst=20= erc-dcc-ctcp-query-send-regexp=0A-=20=20(concat=20"^DCC=20SEND=20\\("=0A= +=20=20(concat=20"^DCC=20SEND=20\\(?:"=0A=20=20=20=20=20=20=20=20=20=20=20= ;;=20Following=20part=20matches=20either=20filename=20without=20spaces=0A= =20=20=20=20=20=20=20=20=20=20=20;;=20or=20filename=20enclosed=20in=20= double=20quotes=20with=20any=20number=0A=20=20=20=20=20=20=20=20=20=20=20= ;;=20of=20escaped=20double=20quotes=20inside.=0A-=20=20=20=20=20=20=20=20= =20=20"\"\\(\\(.*?\\(\\\\\"\\)?\\)+?\\)\"\\|\\([^=20]+\\)"=0A+=20=20=20=20= =20=20=20=20=20=20"\"\\(\\(?:\\\\\"\\|[^\"\\]\\)+\\)\"\\|\\([^=20]+\\)"=0A= =20=20=20=20=20=20=20=20=20=20=20"\\)=20\\([0-9]+\\)=20\\([0-9]+\\)=20= *\\([0-9]*\\)"))=0A=20=0A=20(define-inline=20erc-dcc-unquote-filename=20= (filename)=0A@@=20-653,11=20+653,11=20@@=20erc-dcc-handle-ctcp-send=0A=20= =20=20=20=20=20=20=20?r=20"SEND"=20?n=20nick=20?u=20login=20?h=20host))=0A= =20=20=20=20=20=20((string-match=20erc-dcc-ctcp-query-send-regexp=20= query)=0A=20=20=20=20=20=20=20(let=20((filename=0A-=20=20=20=20=20=20=20=20= =20=20=20=20=20(or=20(match-string=205=20query)=0A-=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(erc-dcc-unquote-filename=20(match-string=202=20= query))))=0A-=20=20=20=20=20=20=20=20=20=20=20=20(ip=20=20=20=20=20=20=20= (erc-decimal-to-ip=20(match-string=206=20query)))=0A-=20=20=20=20=20=20=20= =20=20=20=20=20(port=20=20=20=20=20(match-string=207=20query))=0A-=20=20=20= =20=20=20=20=20=20=20=20=20(size=20=20=20=20=20(match-string=208=20= query)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20(or=20(match-string=20= 2=20query)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (erc-dcc-unquote-filename=20(match-string=201=20query))))=0A+=20=20=20=20= =20=20=20=20=20=20=20=20(ip=20=20=20=20=20=20=20(erc-decimal-to-ip=20= (match-string=203=20query)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20= (port=20=20=20=20=20(match-string=204=20query))=0A+=20=20=20=20=20=20=20=20= =20=20=20=20(size=20=20=20=20=20(match-string=205=20query)))=0A=20=20=20=20= =20=20=20=20=20;;=20FIXME:=20a=20warning=20really=20should=20also=20be=20= sent=0A=20=20=20=20=20=20=20=20=20;;=20if=20the=20ip=20address=20!=3D=20= the=20host=20the=20dcc=20sender=20is=20on.=0A=20=20=20=20=20=20=20=20=20= (erc-display-message=0Adiff=20--git=20a/lisp/net/puny.el=20= b/lisp/net/puny.el=0Aindex=2060a6c12e6c..6987d25324=20100644=0A---=20= a/lisp/net/puny.el=0A+++=20b/lisp/net/puny.el=0A@@=20-35,7=20+35,7=20@@=20= puny-encode-domain=0A=20For=20instance,=20\"f=C5=9Bf.org\"=20=3D>=20= \"xn--ff-2sa.org\"."=0A=20=20=20;;=20The=20vast=20majority=20of=20domain=20= names=20are=20not=20IDNA=20domain=20names,=20so=0A=20=20=20;;=20add=20a=20= check=20first=20to=20avoid=20doing=20unnecessary=20work.=0A-=20=20(if=20= (string-match=20"\\'[[:ascii:]]+\\'"=20domain)=0A+=20=20(if=20= (string-match=20"\\`[[:ascii:]]+\\'"=20domain)=0A=20=20=20=20=20=20=20= domain=0A=20=20=20=20=20(mapconcat=20'puny-encode-string=20(split-string=20= domain=20"[.]")=20".")))=0A=20=0Adiff=20--git=20a/lisp/org/org-table.el=20= b/lisp/org/org-table.el=0Aindex=2098702feb37..8927b1c2ed=20100644=0A---=20= a/lisp/org/org-table.el=0A+++=20b/lisp/org/org-table.el=0A@@=20-2005,7=20= +2005,7=20@@=20org-table-finish-edit-field=0A=20=09text)=0A=20=20=20=20=20= (goto-char=20(point-min))=0A=20=20=20=20=20(while=20(re-search-forward=20= "^#.*\n?"=20nil=20t)=20(replace-match=20""))=0A-=20=20=20=20(while=20= (re-search-forward=20"\\([=20\t]*\n[=20\t]*\\)+"=20nil=20t)=0A+=20=20=20=20= (while=20(re-search-forward=20"[=20\t]*\\(?:\n[=20\t]*\\)+"=20nil=20t)=0A= =20=20=20=20=20=20=20(replace-match=20"=20"))=0A=20=20=20=20=20(setq=20= text=20(org-trim=20(buffer-string)))=0A=20=20=20=20=20= (set-window-configuration=20cw)=0Adiff=20--git=20= a/lisp/progmodes/gdb-mi.el=20b/lisp/progmodes/gdb-mi.el=0Aindex=20= ba586981de..c1184211d0=20100644=0A---=20a/lisp/progmodes/gdb-mi.el=0A+++=20= b/lisp/progmodes/gdb-mi.el=0A@@=20-1867,7=20+1867,7=20@@=20= gdb-control-commands-regexp=0A=20=20=20=20= "\\|def\\(i\\(ne?\\)?\\)?\\|doc\\(u\\(m\\(e\\(nt?\\)?\\)?\\)?\\)?\\|"=0A=20= =20=20=20gdb-python-guile-commands-regexp=0A=20=20=20=20= "\\|while-stepping\\|stepp\\(i\\(ng?\\)?\\)?\\|ws\\|actions"=0A-=20=20=20= "\\|expl\\(o\\(r\\e?\\)?\\)?"=0A+=20=20=20"\\|expl\\(o\\(re?\\)?\\)?"=0A=20= =20=20=20"\\)\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$")=0A=20=20=20= "Regexp=20matching=20GDB=20commands=20that=20enter=20a=20recursive=20= reading=20loop.=0A=20As=20long=20as=20GDB=20is=20in=20the=20recursive=20= reading=20loop,=20it=20does=20not=20expect=0Adiff=20--git=20= a/lisp/progmodes/scheme.el=20b/lisp/progmodes/scheme.el=0Aindex=20= 751d7da542..33ba0d11d8=20100644=0A---=20a/lisp/progmodes/scheme.el=0A+++=20= b/lisp/progmodes/scheme.el=0A@@=20-116,7=20+116,7=20@@=20= 'scheme-mode-abbrev-table=0A=20=0A=20(defvar=20= scheme-imenu-generic-expression=0A=20=20=20=20=20=20=20'((nil=0A-=20=20=20= =20=20=20=20=20=20= "^(define\\(\\|-\\(generic\\(\\|-procedure\\)\\|method\\)\\)*\\s-+(?\\(\\s= w+\\)"=204)=0A+=20=20=20=20=20=20=20=20=20= "^(define\\(?:-\\(?:generic\\(?:-procedure\\)?\\|method\\)\\)?\\s-+(?\\(\\= sw+\\)"=201)=0A=20=20=20=20=20=20=20=20=20("Types"=0A=20=20=20=20=20=20=20= =20=20=20"^(define-class\\s-+(?\\(\\sw+\\)"=201)=0A=20=20=20=20=20=20=20=20= =20("Macros"=0Adiff=20--git=20a/lisp/textmodes/sgml-mode.el=20= b/lisp/textmodes/sgml-mode.el=0Aindex=206152a8ad0a..9b29b844d0=20100644=0A= ---=20a/lisp/textmodes/sgml-mode.el=0A+++=20= b/lisp/textmodes/sgml-mode.el=0A@@=20-286,7=20+286,10=20@@=20= sgml-slash-distance=0A=20(defconst=20sgml-namespace-re=20= "[_[:alpha:]][-_.[:alnum:]]*")=0A=20(defconst=20sgml-name-re=20= "[_:[:alpha:]][-_.:[:alnum:]]*")=0A=20(defconst=20sgml-tag-name-re=20= (concat=20"<\\([!/?]?"=20sgml-name-re=20"\\)"))=0A-(defconst=20= sgml-attrs-re=20"\\(?:[^\"'/><]\\|\"[^\"]*\"\\|'[^']*'\\)*")=0A= +(defconst=20sgml-attrs-re=0A+=20=20;;=20This=20pattern=20cannot=20begin=20= with=20a=20character=20matched=20by=20the=20end=20of=0A+=20=20;;=20= `sgml-name-re'=20above.=0A+=20=20= "\\(?:[^_.:\"'/><[:alnum:]-]\\(?:[^\"'/><]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?"= )=0A=20(defconst=20sgml-start-tag-regex=20(concat=20"<"=20sgml-name-re=20= sgml-attrs-re)=0A=20=20=20"Regular=20expression=20that=20matches=20a=20= non-empty=20start=20tag.=0A=20Any=20terminating=20`>'=20or=20`/'=20is=20= not=20matched.")=0Adiff=20--git=20a/lisp/vc/diff-mode.el=20= b/lisp/vc/diff-mode.el=0Aindex=20da2d5ed50e..d194d6c0a0=20100644=0A---=20= a/lisp/vc/diff-mode.el=0A+++=20b/lisp/vc/diff-mode.el=0A@@=20-484,7=20= +484,7=20@@=20diff-imenu-generic-expression=0A=20=20=20;;=20Prefer=20= second=20name=20as=20first=20is=20most=20likely=20to=20be=20a=20backup=20= or=0A=20=20=20;;=20version-control=20name.=20=20The=20[\t\n]=20at=20the=20= end=20of=20the=20unidiff=20pattern=0A=20=20=20;;=20catches=20Debian=20= source=20diff=20files=20(which=20lack=20the=20trailing=20date).=0A-=20=20= '((nil=20"\\+\\+\\+\\=20\\([^\t\n]+\\)[\t\n]"=201)=20;=20unidiffs=0A+=20=20= '((nil=20"\\+\\+\\+=20\\([^\t\n]+\\)[\t\n]"=201)=20;=20unidiffs=0A=20=20=20= =20=20(nil=20"^---=20\\([^\t\n]+\\)\t.*\n\\*"=201)))=20;=20context=20= diffs=0A=20=0A=20;;;;=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A=0A= --Apple-Mail=_A03DEBE3-B92F-4624-8ECC-EE2F9C4079C6--