GNU bug report logs - #55744
infinite loop

Previous Next

Package: emacs;

Reported by: "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com>

Date: Tue, 31 May 2022 19:51:01 UTC

Severity: normal

Tags: moreinfo, notabug

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55744 in the body.
You can then email your comments to 55744 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55744; Package emacs. (Tue, 31 May 2022 19:51:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 31 May 2022 19:51:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: infinite loop
Date: Tue, 31 May 2022 12:49:35 -0700
[Message part 1 (text/plain, inline)]
The attached file contains the string "end--" in two places.  When
searching for that string with M-x isearch-forward (C-s) in that file,
just after opening the file, starting from the top of the file, it often
happens, that after positioning the cursor at the first "end" in the file,
it displays "end-" on the mode line and then goes into an infinite loop,
not responding to further input or making any further
progress on the search.




In GNU Emacs 28.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60
Version 10.14.6 (Build 18G95))
 of 2022-04-22 built on builder10-14.lan
Windowing system distributor 'Apple', version 10.3.2113
System Description:  macOS 12.3

Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
ACL GMP GNUTLS JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER THREADS
TOOLKIT_SCROLL_BARS ZLIB

Important settings:
  value of $EMACSLOADPATH:
/Applications/LilyPond.app/Contents/Resources/share/emacs/site-lisp:/Users/dan/local/share/emacs/site-lisp:/usr/local/share/emacs/site-lisp:
  value of $LC_ALL: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Info

Minor modes in effect:
  global-edit-server-edit-mode: t
  icomplete-mode: t
  global-auto-revert-mode: t
  auto-image-file-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
/Users/dan/src/M2/M2.git/M2/Macaulay2/editors/emacs/M2-symbols hides
/Applications/Macaulay2-1.20/share/emacs/site-lisp/macaulay2/M2-symbols
/Users/dan/src/M2/M2.git/M2/Macaulay2/editors/emacs/M2 hides
/Applications/Macaulay2-1.20/share/emacs/site-lisp/macaulay2/M2
/Users/dan/src/M2/M2.git/M2/Macaulay2/editors/emacs/M2-init hides
/Applications/Macaulay2-1.20/share/emacs/site-lisp/macaulay2/M2-init
/Users/dan/src/M2/M2.git/M2/Macaulay2/editors/emacs/M2-mode hides
/Applications/Macaulay2-1.20/share/emacs/site-lisp/macaulay2/M2-mode
/Users/dan/emacs/gedcom hides /Users/dan/home/emacs/gedcom
/Users/dan/src/M2/M2.git/M2/Macaulay2/editors/emacs/M2-symbols hides
/usr/local/share/emacs/site-lisp/macaulay2/M2-symbols
/Users/dan/src/M2/M2.git/M2/Macaulay2/editors/emacs/M2 hides
/usr/local/share/emacs/site-lisp/macaulay2/M2
/Users/dan/src/M2/M2.git/M2/Macaulay2/editors/emacs/M2-init hides
/usr/local/share/emacs/site-lisp/macaulay2/M2-init
/Users/dan/src/M2/M2.git/M2/Macaulay2/editors/emacs/M2-mode hides
/usr/local/share/emacs/site-lisp/macaulay2/M2-mode
/Users/dan/emacs/rmail hides
/Applications/Emacs.app/Contents/Resources/lisp/mail/rmail
/Users/dan/home/emacs/longlines hides
/Applications/Emacs.app/Contents/Resources/lisp/obsolete/longlines

Features:
(shadow sort mail-extr warnings emacsbug message rmc puny rfc822 mml
mml-sec epa epg rfc6068 epg-config gnus-util rmail mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils thai-util
thai-word lao-util enriched facemenu view vc-git diff-mode vc-dispatcher
M2 M2-symbols rx jka-compr dired-aux dired dired-loaddefs misearch
multi-isearch eieio-opt cl-extra speedbar ezimage dframe find-func
shortdoc thingatpt help-fns radix-tree tabify imenu man agda2-mode pcase
derived agda2-queue agda2-abbrevs skeleton agda2-highlight agda2
annotation eri time-date pp agda-input quail help-mode edit-server
easy-mmode edmacro kmacro server generic disp-table cc-styles cc-align
cc-engine cc-vars cc-defs icomplete grep compile text-property-search
comint ansi-color ring autorevert filenotify image-file image-converter
cus-load info proof-site proof-autoloads package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize
mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads kqueue cocoa ns multi-tty
make-network-process emacs)

Memory information:
((conses 16 299140 12614)
 (symbols 48 14179 3)
 (strings 32 50438 2510)
 (string-bytes 1 1513842)
 (vectors 16 26190)
 (vector-slots 8 305278 27939)
 (floats 8 93 32)
 (intervals 56 7639 129)
 (buffers 992 27))
[Message part 2 (text/html, inline)]
[Topcom.m2 (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55744; Package emacs. (Tue, 31 May 2022 20:13:01 GMT) Full text and rfc822 format available.

Message #8 received at 55744 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com>
Cc: 55744 <at> debbugs.gnu.org
Subject: Re: bug#55744: infinite loop
Date: Tue, 31 May 2022 22:12:40 +0200
"Daniel R. Grayson" <danielrichardgrayson <at> gmail.com> writes:

> The attached file contains the string "end--" in two places.  When
> searching for that string with M-x isearch-forward (C-s) in that file,
> just after opening the file, starting from the top of the file, it
> often happens, that after positioning the cursor at the first "end" in
> the file, it displays "end-" on the mode line and then goes into an
> infinite loop, not responding to further input or making any further
> progress on the search.

I'm unable to reproduce this in Emacs 28.1 (on Debian/bookworm).  Is
this with "emacs -Q"?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55744; Package emacs. (Tue, 31 May 2022 20:27:02 GMT) Full text and rfc822 format available.

Message #11 received at 55744 <at> debbugs.gnu.org (full text, mbox):

From: "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55744 <at> debbugs.gnu.org
Subject: Re: bug#55744: infinite loop
Date: Tue, 31 May 2022 13:26:19 -0700
[Message part 1 (text/plain, inline)]
Nope, no command line options.

On Tue, May 31, 2022 at 1:12 PM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com> writes:
>
> > The attached file contains the string "end--" in two places.  When
> > searching for that string with M-x isearch-forward (C-s) in that file,
> > just after opening the file, starting from the top of the file, it
> > often happens, that after positioning the cursor at the first "end" in
> > the file, it displays "end-" on the mode line and then goes into an
> > infinite loop, not responding to further input or making any further
> > progress on the search.
>
> I'm unable to reproduce this in Emacs 28.1 (on Debian/bookworm).  Is
> this with "emacs -Q"?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55744; Package emacs. (Tue, 31 May 2022 20:29:01 GMT) Full text and rfc822 format available.

Message #14 received at 55744 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com>
Cc: 55744 <at> debbugs.gnu.org
Subject: Re: bug#55744: infinite loop
Date: Tue, 31 May 2022 22:28:32 +0200
"Daniel R. Grayson" <danielrichardgrayson <at> gmail.com> writes:

> Nope, no command line options.

I mean, can you reproduce this problem with "emacs -Q" (which makes
Emacs start up without reading your init files)?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55744; Package emacs. (Tue, 31 May 2022 20:43:01 GMT) Full text and rfc822 format available.

Message #17 received at 55744 <at> debbugs.gnu.org (full text, mbox):

From: "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55744 <at> debbugs.gnu.org
Subject: Re: bug#55744: infinite loop
Date: Tue, 31 May 2022 13:42:27 -0700
[Message part 1 (text/plain, inline)]
Ah, indeed, the bug doesn't seem to be reproducible with "-Q".  I attach my
.emacs and .emacs-Macaulay2.
[Message part 2 (text/html, inline)]
[.emacs (application/octet-stream, attachment)]
[.emacs-Macaulay2 (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55744; Package emacs. (Wed, 01 Jun 2022 02:30:02 GMT) Full text and rfc822 format available.

Message #20 received at 55744 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com>
Cc: 55744 <at> debbugs.gnu.org
Subject: Re: bug#55744: infinite loop
Date: Wed, 01 Jun 2022 04:29:39 +0200
"Daniel R. Grayson" <danielrichardgrayson <at> gmail.com> writes:

> Ah, indeed, the bug doesn't seem to be reproducible with "-Q".  I
> attach my .emacs and .emacs-Macaulay2.

Try removing things from those to determine what triggers the problem.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 01 Jun 2022 13:39:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55744; Package emacs. (Wed, 01 Jun 2022 14:28:02 GMT) Full text and rfc822 format available.

Message #25 received at 55744 <at> debbugs.gnu.org (full text, mbox):

From: "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55744 <at> debbugs.gnu.org
Subject: Re: bug#55744: infinite loop
Date: Wed, 1 Jun 2022 07:27:22 -0700
[Message part 1 (text/plain, inline)]
Okay, I did that, and it seems to be this:

(defconst M2-mode-font-lock-keywords ' (
"///\\(/?/?[^/]\\|\\(//\\)*////[^/]\\)*\\(//\\)*///" .
'font-lock-string-face) )
(define-derived-mode M2-mode prog-mode "Macaulay2" (setq font-lock-defaults
'( M2-mode-font-lock-keywords )) )
(add-to-list 'auto-mode-alist '("\\.m2\\'" . M2-mode))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55744; Package emacs. (Wed, 01 Jun 2022 15:36:02 GMT) Full text and rfc822 format available.

Message #28 received at 55744 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com>
Cc: 55744 <at> debbugs.gnu.org
Subject: Re: bug#55744: infinite loop
Date: Wed, 01 Jun 2022 17:35:04 +0200
"Daniel R. Grayson" <danielrichardgrayson <at> gmail.com> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55744; Package emacs. (Wed, 01 Jun 2022 15:49:01 GMT) Full text and rfc822 format available.

Message #31 received at 55744 <at> debbugs.gnu.org (full text, mbox):

From: "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55744 <at> debbugs.gnu.org
Subject: Re: bug#55744: infinite loop
Date: Wed, 1 Jun 2022 08:47:38 -0700
[Message part 1 (text/plain, inline)]
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 <larsi <at> gnus.org> wrote:

> "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com> 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
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55744; Package emacs. (Wed, 01 Jun 2022 15:49:02 GMT) Full text and rfc822 format available.

Message #34 received at 55744 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com>
Cc: 55744 <at> debbugs.gnu.org
Subject: Re: bug#55744: infinite loop
Date: Wed, 01 Jun 2022 17:48:45 +0200
"Daniel R. Grayson" <danielrichardgrayson <at> gmail.com> writes:

> Thanks, it's not a bug in emacs!

Thanks; I'm closing this bug report, then.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) notabug. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 01 Jun 2022 15:50:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 55744 <at> debbugs.gnu.org and "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 01 Jun 2022 15:50:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55744; Package emacs. (Mon, 06 Jun 2022 22:16:01 GMT) Full text and rfc822 format available.

Message #41 received at 55744 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: danielrichardgrayson <at> gmail.com, 55744 <at> debbugs.gnu.org
Subject: Re: bug#55744: infinite loop
Date: Mon, 06 Jun 2022 18:15:06 -0400
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > 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.

Would it make sense to say more about this point in the Emacs Lisp Manual
where it describes regexps?

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55744; Package emacs. (Mon, 06 Jun 2022 22:47:02 GMT) Full text and rfc822 format available.

Message #44 received at 55744 <at> debbugs.gnu.org (full text, mbox):

From: "Daniel R. Grayson" <danielrichardgrayson <at> gmail.com>
To: rms <at> gnu.org
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 55744 <at> debbugs.gnu.org
Subject: Re: bug#55744: infinite loop
Date: Mon, 6 Jun 2022 15:46:02 -0700
[Message part 1 (text/plain, inline)]
Conceivably, although I wasn't referring to the manual, even after I
isolated the offending
regexp.

On Mon, Jun 6, 2022 at 3:15 PM Richard Stallman <rms <at> gnu.org> wrote:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > 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.
>
> Would it make sense to say more about this point in the Emacs Lisp Manual
> where it describes regexps?
>
> --
> Dr Richard Stallman (https://stallman.org)
> Chief GNUisance of the GNU Project (https://gnu.org)
> Founder, Free Software Foundation (https://fsf.org)
> Internet Hall-of-Famer (https://internethalloffame.org)
>
>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55744; Package emacs. (Tue, 07 Jun 2022 02:29:02 GMT) Full text and rfc822 format available.

Message #47 received at 55744 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: rms <at> gnu.org
Cc: larsi <at> gnus.org, danielrichardgrayson <at> gmail.com, 55744 <at> debbugs.gnu.org
Subject: Re: bug#55744: infinite loop
Date: Tue, 07 Jun 2022 05:28:08 +0300
> Cc: danielrichardgrayson <at> gmail.com, 55744 <at> debbugs.gnu.org
> From: Richard Stallman <rms <at> gnu.org>
> Date: Mon, 06 Jun 2022 18:15:06 -0400
> 
>   > 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.
> 
> Would it make sense to say more about this point in the Emacs Lisp Manual
> where it describes regexps?

I think we already do, see the node "Regexp Problems" there.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 05 Jul 2022 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 351 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.