unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: jan via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 41155@debbugs.gnu.org
Subject: bug#41155: 26.3; regexp 99% locks up emacs
Date: Wed, 13 May 2020 10:11:57 +0100	[thread overview]
Message-ID: <CADJx9LdjbTk2kS+wkL_Yn1cKMsNo8nDgt5H2gDJOQnq-cz8f-g@mail.gmail.com> (raw)
In-Reply-To: <CADJx9Ld7XJcdi8kh-Jtg9gwNEMiErmUcXY9G-O=Mjis0N20m1Q@mail.gmail.com>

I've had more of a play, I see what you're saying and it makes sense.

It locks up because it's a pathological, but C-g *will* interrupt it.
My mistake was thinking it would cancel the highlight-regexp, but of
course it doesn't, emacs handles a few keyboard events then goes right
back to its inefficient scanning.

So I get a self-inflicted denial of service. That may be a problem but
it isn't the one I originally reported.

I'm not sure the regexp is in fact working correctly but I'll leave it for now.

Would someone consider this closing this issue please?

thanks

jan

On 12/05/2020, jan <rtm443x@googlemail.com> wrote:
> I'm not sure that's the whole issue though
>
> 1. C-g does not break out.   If emacs simply hands off to a
> C-language-based regex engine and waits for it to return then that
> *may* be inevitable but I don't know.
>
> 2. I've done a bit of experimenting just now and something doesn't add
> up, I'll try to reproduce that tomorrow, draw some conclusions and
> post here.
>
> Thanks for the feedback. And the equation solver weirdness, which I'll
> read in detail later!
>
> thanks
>
> jan
>
> On 12/05/2020, Paul Eggert <eggert@cs.ucla.edu> wrote:
>>> I originally put it down to the regexp being clearly pathalogical
>>
>> Yes, that's pretty much it. Emacs uses a backtracking matcher and its
>> worst
>> case
>> performance is exponential. You can even use the matcher to solve
>> Diophantine
>> integer equations ... verrrryy slowly; see:
>>
>> http://blog.stevenlevithan.com/archives/algebra-with-regexes
>>
>> So, don't do that. (Or if you *do* want to do that, fix the matcher - but
>> good
>> luck with that....)
>>
>





  reply	other threads:[~2020-05-13  9:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09 17:31 bug#41155: 26.3; regexp 99% locks up emacs jan via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-05-12 20:56 ` Paul Eggert
2020-05-12 22:28   ` jan via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-05-13  9:11     ` jan via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2020-05-14  4:46       ` Paul Eggert

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=CADJx9LdjbTk2kS+wkL_Yn1cKMsNo8nDgt5H2gDJOQnq-cz8f-g@mail.gmail.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=41155@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=rtm443x@googlemail.com \
    /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).