[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [solved but not fixed] mutt freezing



On Fri, Mar 11, 2005 at 12:47:42AM +1300, Chris Bannister wrote:
| On Wed, Mar 09, 2005 at 02:09:32AM +1300, Chris Bannister wrote:
| > On Tue, Mar 08, 2005 at 12:24:49AM +0100, Michelle Konzack wrote:
| > > Am 2005-03-08 11:19:59, schrieb Chris Bannister:
|  
| > > What about installing mutt 1.5.6 from backports.org too ?
| > 
| > Good point.
|  
| > I'll see if mutt from backports.org fixes it.
| 
| Installed mutt from backports.org
| 
| Trouble caused by the following regular expression:
| 
| 
| color body brightwhite default
| "(^|[[:space:]]+)?([[:punct:]]|[?!])*[*_/][-_[:alnum:]]+[*_/]([[:punct:]]|[?!])*($|[[:space:]]+)"
| # emphasized text: *blah* _blah_ /blah/
| 
| 
| in .muttrc
| 
| if this text in message:
| 
| Please help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
| 
| I got that regex of the net, can't remember where.
| 
| Can anyone else confirm it freezes mutt?

Aha!  It's not frozen.  Rather, mutt is running just as it is supposed
to.  The regex is merely poorly crafted and as such requires an
extreme amount of CPU processing when presented with specific input.

Well, I assume that's the case. I haven't inspected the pattern
closely, but I do know a thing or two about regexes.  (so I'm writing
a quick response to hopefully point you in the right direction)  After
a quick look, I'd suggest trying to rewrite that (probably using two
ore more separate patterns) with fewer alternations (the |) and greedy
quantifiers (the * and +).  I suspect, too, that the "problem"
messages have really long lines with no line breaks.

Jeffrey Friedl's O'Reilly book is excellent if you want to learn.  One
of the first things he covers is the concept behind how regex engines
work and how the performance of one class of engines is affected by
the patterns supplied to it.  Specifically how the greedy quantifiers
cause excessive backtracking on the input if the pattern doesn't
match, and how anchoring the expression at the beginning reduces a lot
of processing as the engine tries to figure out where in the input
stream a match might begin.

HTH,
-D

-- 
Running Windows is kinda like playing blackjack:
User stays on success, reboots on failure
 
www: http://dman13.dyndns.org/~dman/            jabber: dman@dman13.dyndns.org

Attachment: signature.asc
Description: Digital signature


Reply to: