unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: 34823@debbugs.gnu.org
Subject: bug#34823: 27.0.50; re-search-forward infloop
Date: Fri, 29 Mar 2019 14:28:18 +0100	[thread overview]
Message-ID: <B5915A5D-14EB-47F6-99EC-26AD8C7C7D5E@acm.org> (raw)
In-Reply-To: <87y35kqse3.fsf@gmail.com>

It is not actually an infinite loop; it just takes a very long time.

Your case is, more or less, essentially

(search-string "\\(?:a*\\)*b" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")

Try trimming the string, and you will see that the match does terminate (and fail); it is just super-linear in the length of the text.
This is a shortcoming of the general type of regexp engine used by Emacs.

To work around your problem, you should make the regexp less prone to backtracking. Try asking on the list help-gnu-emacs@gnu.org for advice. Describe what text you wish to match as precisely as possible.






      reply	other threads:[~2019-03-29 13:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12 10:49 bug#34823: 27.0.50; re-search-forward infloop Vitalie Spinu
2019-03-29 13:28 ` Mattias Engdegård [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B5915A5D-14EB-47F6-99EC-26AD8C7C7D5E@acm.org \
    --to=mattiase@acm.org \
    --cc=34823@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).