Message16368
This *may* be similar to
<http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=439997>,
but I don't think the current behavior (infinite
loop/unbound execution) is correct.
Here's the python version:
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
#!/usr/bin/python
import re
pattern =
'^UPDATE\s+\w+\s+SET\s+locked_until\s*=\s*(\S+\s*)+,'
# This won't match (missing ',' at end
str = 'UPDATE arena_teams SET locked_until =
CAST(EXTRACT(EPOCH FROM CURRENT_TIMESTAMP)'
re.search(pattern, str, re.I)
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
When run, this script just pegs the CPU and hangs (I'm
running RedHat 8.0). Note: if I change the pattern
slightly it still doesn't work:
pattern = '^UPDATE\s+\w+\s+SET\s+locked_until\s*=\s*([^
=,]+\s*)+,'
It's not until the pattern actually matches that things
get better (with both the original and modified patterns):
# Pattern now matches (added a ',' at the end)
str = 'UPDATE arena_teams SET locked_until =
CAST(EXTRACT(EPOCH FROM CURRENT_TIMESTAMP),'
I tried doing the same thing in Perl:
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
#!/usr/bin/perl
'UPDATE arena_teams SET locked_until =
CAST(EXTRACT(EPOCH FROM CURRENT_TIMESTAMP)' =~
'/UPDATE\s+\w+\s+SET\s+locked_until\s*=\s*(\S+\s*)+,/i';
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
This of course runs just fine. Any ideas? |
|
Date |
User |
Action |
Args |
2007-08-23 14:13:52 | admin | link | issue753711 messages |
2007-08-23 14:13:52 | admin | create | |
|