[Therion] Bug#751471: Bug#751471: Therion hanging after compile

2015-01-13 Thread Olly Betts
On Tue, Jan 13, 2015 at 12:01:51AM +, Olly Betts wrote:
> On Mon, Jan 12, 2015 at 04:29:09PM +0100, Stacho Mudrak wrote:
> > I am sorry, I was never able replicate this bug.
> 
> You need a large log file for it to be noticeable, as the problem seems
> to be that trying to match this pattern causes Tcl's regexp engine to do
> a lot of backtracking:
> 
>   set rx {\S*[^\]\s]\s+\[\d+\]}
> 
> I don't really follow the Tcl code around this, but if this is trying to
> match on lines such as:
> 
> 2253> input:42871 -- gemse.th [4]
> 
> Then adding "-- " to the start of the pattern and then adjusting the
> offsets when highlighting in the text widget should address the problem.
> The fixed substring "-- " serves as a way to efficiently limit where the
> regexp engine tries to match the pattern.

I managed to guess enough tcl and tk to implement this, patch attached
which fixes the 10 minute wait while xtherion parse the log, while still
creating the links as before (at least as best I can tell).

Cheers,
Olly
-- next part --
A non-text attachment was scrubbed...
Name: fix-log-file-regexp-backtracking.patch
Type: text/x-diff
Size: 1099 bytes
Desc: not available
URL: 



[Therion] Bug#751471: Bug#751471: Therion hanging after compile

2015-01-13 Thread Olly Betts
On Mon, Jan 12, 2015 at 04:29:09PM +0100, Stacho Mudrak wrote:
> I am sorry, I was never able replicate this bug.

You need a large log file for it to be noticeable, as the problem seems
to be that trying to match this pattern causes Tcl's regexp engine to do
a lot of backtracking:

  set rx {\S*[^\]\s]\s+\[\d+\]}

I don't really follow the Tcl code around this, but if this is trying to
match on lines such as:

2253> input:42871 -- gemse.th [4]

Then adding "-- " to the start of the pattern and then adjusting the
offsets when highlighting in the text widget should address the problem.
The fixed substring "-- " serves as a way to efficiently limit where the
regexp engine tries to match the pattern.

> If it is this regex that causes problems, it can be removed completely. It
> is used to enable clicking on error source and opening in in appropriate
> editor. Feature almost never used.

If you think it's best just to kill it, that's fine, but I can probably
package up the example that we hit this on if you want to take a look,
and I can certainly test a patch.

Cheers,
Olly