From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Daniel R. Grayson" Newsgroups: gmane.emacs.bugs Subject: bug#55744: infinite loop Date: Wed, 1 Jun 2022 08:47:38 -0700 Message-ID: References: <878rqh4g1z.fsf@gnus.org> <874k154fbj.fsf@gnus.org> <87v8tl2k18.fsf@gnus.org> <87a6aw4ct3.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000fef1bb05e064cfcd" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34515"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55744@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 01 17:49:18 2022 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 1nwQb0-0008io-50 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 01 Jun 2022 17:49:18 +0200 Original-Received: from localhost ([::1]:59294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwQay-0005tR-FP for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 01 Jun 2022 11:49:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwQak-0005sq-8l for bug-gnu-emacs@gnu.org; Wed, 01 Jun 2022 11:49:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwQaj-0000b9-Tg for bug-gnu-emacs@gnu.org; Wed, 01 Jun 2022 11:49:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nwQaj-0003sX-R7 for bug-gnu-emacs@gnu.org; Wed, 01 Jun 2022 11:49:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Daniel R. Grayson" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 Jun 2022 15:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55744 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 55744-submit@debbugs.gnu.org id=B55744.165409848314778 (code B ref 55744); Wed, 01 Jun 2022 15:49:01 +0000 Original-Received: (at 55744) by debbugs.gnu.org; 1 Jun 2022 15:48:03 +0000 Original-Received: from localhost ([127.0.0.1]:51664 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nwQZm-0003qC-CL for submit@debbugs.gnu.org; Wed, 01 Jun 2022 11:48:02 -0400 Original-Received: from mail-lf1-f47.google.com ([209.85.167.47]:38907) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nwQZk-0003pF-Og for 55744@debbugs.gnu.org; Wed, 01 Jun 2022 11:48:01 -0400 Original-Received: by mail-lf1-f47.google.com with SMTP id c19so3442114lfv.5 for <55744@debbugs.gnu.org>; Wed, 01 Jun 2022 08:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PUM1LClBOZ/NflNu70ZEePg8OddJDUPBg+fK37yDFjI=; b=EF/YEn0ouyCdDPwuO3QYQE6ztgKtlVlrC+xybC3jzdnkO3KML32EB4ACeSokix1oYh hcbGR7/8k3rpjkVS2ZRFehhit6m+Sqki3CiERFumcvoBLqmxLZtMUz1GhyQBKiXLaH33 O+UQf+TnZg1Q1+lMWTtKUPB/965hArYhbIJo8kVc4UWFbYygW7E3yUsMkEsXiLgGNpYi upitfKNC2+o8woL+w9IztBZQ9E7I123MwplrJ+OvFUdKPVUk1J+rHJDzoXhmwkZwZbOt jCXbS0DVdvxj1CPcpxEp/TmhFidF1kFRWE0bRdxkW+A4yNpC1xZXEOMwg/x0no02pR7I +H2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PUM1LClBOZ/NflNu70ZEePg8OddJDUPBg+fK37yDFjI=; b=i8tJZFWlZ4mxxP+AWr/D9OH9/x7PDLOKeG4jV3F87b6wNW2WSTBCpfgLtSnHUhQRkv wtlIvcp93yiQ0kCVR2b9MggCzDV5aHmoFaaUdrcoAvZ8kPmz4nQZ8n5ufqMIlSs7Ab6e 4G9JPr66a9/1KPArVLZnQHBn/XMFehpdjcXkyGgDVmf+meMP/5jgsFc6DgBMnjOvqt5z 5lG0x497RNwZv7r+11bPoVPpgqlSFq8tt9y1LcPvX+zE9JM5kfAUWzMOycyGtYSQceCt b8ObpJwfocqcQQoFfzWHleBQA9yiDOJggSNT3bU9pstdmhUS90KMj4SSxcg4AWlF2eYo 9TCQ== X-Gm-Message-State: AOAM533Ihn0ZdoWm2T2hKyn5YlJZnseu6OaFb65PgST7ekgeOYyec+Nw sSrhP9b1YoLMkWh9fDn5jE+Jkc6Q46+eFAQjSVU= X-Google-Smtp-Source: ABdhPJzkO4Gj6gMDD6E1F4DKWZIkyKeQsctE5bHxZ6SKnhEROlUxRkhXYzAWNYCN/fgapCQE5b+gzWFyJK4tTYbRQLw= X-Received: by 2002:a05:6512:22d2:b0:478:6898:15d6 with SMTP id g18-20020a05651222d200b00478689815d6mr37021052lfu.577.1654098474494; Wed, 01 Jun 2022 08:47:54 -0700 (PDT) In-Reply-To: <87a6aw4ct3.fsf@gnus.org> 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:233495 Archived-At: --000000000000fef1bb05e064cfcd Content-Type: text/plain; charset="UTF-8" Ah, you're right -- if I wait 45 seconds or so, it finally finishes and moves on, and that file has strings that should have matched it. And it needs to match all the text from the start of the file, since string starts and string ends look the same. And the result is the same if I search for any other string that first occurs deep into the file. Thanks, it's not a bug in emacs! On Wed, Jun 1, 2022 at 8:35 AM Lars Ingebrigtsen wrote: > "Daniel R. Grayson" writes: > > > Okay, I did that, and it seems to be this: > > > > (defconst M2-mode-font-lock-keywords > > '("///\\(/?/?[^/]\\|\\(//\\)*////[^/]\\)*\\(//\\)*///" . > > 'font-lock-string-face) ) > > That's a regexp with a lot of backtracking, I think (i.e., elements that > can be matched both by the ?'s as well as the two *'s). So matching > this will be slow, which results in the hangs you're seeing when Emacs > is trying to match that to the text in the buffer. > > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no > --000000000000fef1bb05e064cfcd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ah, you're right -- if I wait 45 seconds or so, it fin= ally finishes and moves on,
and that file has strings that should have = matched it.=C2=A0 And it needs to match all the text
from the sta= rt of the file, since string starts and string ends look the same.=C2=A0 An= d the result is the same
if I search for any other string that fi= rst occurs deep into the file.

Thanks, it's no= t a bug in emacs!



On Wed, Jun 1, 2022 = at 8:35 AM Lars Ingebrigtsen <larsi@gn= us.org> wrote:
"Daniel R. Grayson" <danielrichardgrayson@gmail.com> wri= tes:

> Okay, I did that, and it seems to be this:
>
> (defconst M2-mode-font-lock-keywords
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'("///\\(/?/?[^/]\\|\= \(//\\)*////[^/]\\)*\\(//\\)*///" .
> 'font-lock-string-face) )

That's a regexp with a lot of backtracking, I think (i.e., elements tha= t
can be matched both by the ?'s as well as the two *'s).=C2=A0 So ma= tching
this will be slow, which results in the hangs you're seeing when Emacs<= br> is trying to match that to the text in the buffer.

--
(domestic pets only, the antidote for overdose, milk.)
=C2=A0 =C2=A0bloggy blog: http://lars.ingebrigtsen.no
--000000000000fef1bb05e064cfcd--