all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Eli Zaretskii <eliz@gnu.org>
Cc: acm@muc.de, schwab@linux-m68k.org, monnier@iro.umontreal.ca,
	18577@debbugs.gnu.org
Subject: bug#18577: Regexp I-search: [(error Stack overflow in regexp matcher)]
Date: Sat, 23 Oct 2021 02:32:23 -0700	[thread overview]
Message-ID: <CADwFkmm-pTJx40M9OmPeTksMuYHmPp1No7zi=g2Y8hiJnirdgg@mail.gmail.com> (raw)
In-Reply-To: <83ee8c5e48.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 23 Oct 2021 11:39:35 +0300")

[-- Attachment #1: Type: text/plain, Size: 244 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

> Would it be possible to copy the relevant recommendations from that
> discussion to the PROBLEMS entry?  If shown in a cookbook manner, that
> could be very helpful in practice, I think.

How about this?

[-- Attachment #2: 0001-etc-PROBLEMS-Mention-problems-with-regexp-engine.-Bu.patch --]
[-- Type: text/x-diff, Size: 1300 bytes --]

From 91db453ff2236bae5c73c0f42b105737532206de Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Sat, 23 Oct 2021 10:29:30 +0200
Subject: [PATCH] * etc/PROBLEMS: Mention problems with regexp engine. 
 (Bug#18577)

---
 etc/PROBLEMS | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index ede83a6e7c..daff102a0d 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -742,6 +742,18 @@ completed" message that tls.el relies upon, causing affected Emacs
 functions to hang.  To work around the problem, use older or newer
 versions of gnutls-cli, or use Emacs's built-in gnutls support.
 
+*** Stack overflow in regexp matcher.
+Due to fundamental limitations in the way Emacs' regular expression
+engine is designed, you might run into combinatorial explosions in
+backtracking with certain regexps.
+
+Avoid "\(...\(...\)*...\)*" and "\(...\)*\(...\)*".  Look for a way to
+anchor your regular expression, to avoid matching the null string in
+infinite ways.  The latter is what creates backtrack points, and
+eventual overflow in practice.
+
+(Also prefer "\(?:...\)" to "\(...\)" unless you need the latter.)
+
 * Runtime problems related to font handling
 
 ** Characters are displayed as empty boxes or with wrong font under X.
-- 
2.30.2


  reply	other threads:[~2021-10-23  9:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-28  8:55 bug#18577: Regexp I-search: [(error Stack overflow in regexp matcher)] Alan Mackenzie
2014-09-28 10:56 ` Andreas Schwab
2014-09-28 12:37   ` Alan Mackenzie
2014-09-28 12:48     ` Andreas Schwab
2014-09-28 17:35       ` Stefan Monnier
2014-11-27  8:44         ` Tassilo Horn
2021-10-23  2:47         ` Stefan Kangas
2021-10-23  7:32           ` Eli Zaretskii
2021-10-23  8:30             ` Stefan Kangas
2021-10-23  8:39               ` Eli Zaretskii
2021-10-23  9:32                 ` Stefan Kangas [this message]
2021-10-23 11:27                   ` Eli Zaretskii
2021-10-24 22:08                     ` Stefan Kangas

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

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

  git send-email \
    --in-reply-to='CADwFkmm-pTJx40M9OmPeTksMuYHmPp1No7zi=g2Y8hiJnirdgg@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=18577@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=schwab@linux-m68k.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.