From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Gregory Heytings <gregory@heytings.org>
Cc: Eli Zaretskii <eliz@gnu.org>, 61514@debbugs.gnu.org, mah@everybody.org
Subject: bug#61514: 30.0.50; sadistically long xml line hangs emacs
Date: Sun, 19 Feb 2023 23:24:30 -0500 [thread overview]
Message-ID: <jwv5ybxou1d.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <a32486a84dc8e337dd51@heytings.org> (Gregory Heytings's message of "Mon, 20 Feb 2023 02:05:59 +0000")
> Looking at the history of that variable, which is in fact a compile-time
> constant, I see that it was initially (May 1995) set to 200000. A few
> months later (Nov 1995) it was set to 20000, and reduced again (apparently
> because of bug reports) to 8000 and to 4000 (both in Jun 1996). Two months
> later it was again set to 20000 (Aug 1996), and a year later to 40000 (Dec
> 1997). It kept that value since then. As these changes (and this bug
> report) demonstrate, it is not possible to give that variable a "one size
> fits all" value.
Note that the stack is allocated with `SAFE_ALLOCA` and used to be
allocated with just `alloca`. So the constant was probably reduced
(back in the 90s) in response to reports of segfaults due to
C stack overflows.
Nowadays we should be hopefully(?) safe from such segfaults since
`SAFE_ALLOCA` only uses `alloca` for smallish allocations.
> @@ -731,7 +731,8 @@ xmltok-scan-after-comment-open
>
> (defun xmltok-scan-attributes ()
> (let ((recovering nil)
> - (atts-needing-normalization nil))
> + (atts-needing-normalization nil)
> + (regexp-max-failures 1000))
> (while (cond ((or (looking-at (xmltok-attribute regexp))
> ;; use non-greedy group
> (when (looking-at (concat "[^<>\n]+?"
This really needs a comment (at least one referring to this bug report).
I think the idea is that we hope the regexp will need at most one stack
entry per character, so the above means that we're willing to limit the
regexp search to about 1kB of text, which sounds fair given it's
supposed to match just a single XML attribute.
> + DEFVAR_INT ("regexp-max-failures", Vregexp_max_failures,
> + doc: /* Maximum number of failures points in a regexp search. */);
> + Vregexp_max_failures = max_regexp_max_failures;
This name is misleading. It suggests it's talking about how many times
we fail, whereas the reality is that it's about the number of pending
branches in the search space (which the source code calls "failure
points" because it's info to be used in case the current branch fails
to match). It could also be described as the number of "pending
continuations" or "stacked failure continuations" or some wording
like that.
But for the var name itself, how 'bout `regexp-max-backtracking-depth`?
Stefan
next prev parent reply other threads:[~2023-02-20 4:24 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-14 21:02 bug#61514: 30.0.50; sadistically long xml line hangs emacs Mark A. Hershberger via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-14 22:05 ` Gregory Heytings
2023-02-15 1:04 ` Mark A. Hershberger
2023-02-15 8:39 ` Gregory Heytings
2023-02-15 10:24 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-15 10:41 ` Gregory Heytings
2023-02-15 10:52 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-15 10:59 ` Gregory Heytings
2023-02-15 11:52 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-15 12:11 ` Gregory Heytings
2023-02-15 12:54 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-15 13:31 ` Gregory Heytings
2023-02-15 13:56 ` Eli Zaretskii
2023-02-15 12:20 ` Dmitry Gutov
2023-02-15 13:58 ` Gregory Heytings
2023-02-15 14:17 ` Eli Zaretskii
2023-02-15 14:34 ` Gregory Heytings
2023-02-18 16:22 ` Eli Zaretskii
2023-02-18 17:06 ` Mark A. Hershberger
2023-02-18 17:58 ` Eli Zaretskii
2023-02-18 23:06 ` Gregory Heytings
2023-02-19 0:46 ` Gregory Heytings
2023-02-19 6:42 ` Eli Zaretskii
2023-02-19 23:12 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-19 23:48 ` Gregory Heytings
2023-02-19 23:58 ` Gregory Heytings
2023-02-20 2:05 ` Gregory Heytings
2023-02-20 4:24 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-02-20 11:28 ` Gregory Heytings
2023-02-20 12:33 ` Eli Zaretskii
2023-02-20 12:31 ` Eli Zaretskii
2023-02-20 12:40 ` Gregory Heytings
2023-02-20 13:14 ` Eli Zaretskii
2023-02-20 14:17 ` Gregory Heytings
2023-02-20 0:14 ` Gregory Heytings
2023-02-20 12:32 ` Eli Zaretskii
2023-02-19 23:48 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-20 12:19 ` Eli Zaretskii
2023-02-20 13:19 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-20 13:54 ` Eli Zaretskii
2023-02-20 14:59 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-20 15:56 ` Gregory Heytings
2023-02-20 16:47 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-20 17:14 ` Gregory Heytings
2023-02-20 17:34 ` Gregory Heytings
2023-02-20 18:49 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-20 19:11 ` Gregory Heytings
2023-02-20 19:29 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-20 19:37 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-20 20:13 ` Gregory Heytings
2023-02-21 12:05 ` Eli Zaretskii
2023-02-21 12:37 ` Gregory Heytings
2023-02-21 13:07 ` Eli Zaretskii
2023-02-21 14:38 ` Gregory Heytings
2023-02-21 14:48 ` Eli Zaretskii
2023-02-21 15:25 ` Gregory Heytings
2023-02-21 15:44 ` Gregory Heytings
2023-02-21 16:58 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-18 10:59 ` Gregory Heytings
2023-03-18 11:10 ` Eli Zaretskii
2023-03-18 15:06 ` Gregory Heytings
2023-03-19 2:39 ` mah via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-21 13:24 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-21 13:35 ` Gregory Heytings
2023-02-20 20:01 ` Eli Zaretskii
2023-02-21 2:23 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-21 9:39 ` Gregory Heytings
2023-02-21 12:44 ` Eli Zaretskii
2023-02-20 17:04 ` Gregory Heytings
2023-02-20 14:06 ` Gregory Heytings
2023-02-20 14:16 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-20 14:24 ` Gregory Heytings
2023-02-20 15:02 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-19 23:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-20 12:41 ` Eli Zaretskii
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=jwv5ybxou1d.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=61514@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=gregory@heytings.org \
--cc=mah@everybody.org \
--cc=monnier@iro.umontreal.ca \
/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.