Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Regression: TCL 8.6.0 cannot compile a long regexp

Closed / Duplicate8d2c0da36d99d48cfd2e8a9e305f2840225936b4Created 13 years agoUpdated 13 years ago
Descriptionplain2013-07-29 19:12:45
The following script, which is a simplified test case, fails in TCL 8.6.0.
It used to work in TCL 8.5.14 (and several older TCL versions; the real
code that started failing in TCL 8.6.0 dates back to 2003 or earlier).

Sample code:

set num "1*"
set time_t "$num $num $num $num $num $num $num $num $num"
set grp "1 3 8 $time_t 00000000 1 13Hxxxxxxxxxxxxx"
set re "^$time_t { $grp $grp $grp $grp $grp $grp $grp $grp $grp $grp $grp }"
regexp $re hi

Expected output: none.

TCL 8.6.0 output:

couldn't compile regular expression pattern: out of memory
    while executing
"regexp $re hi"
    (file "demo.tcl" line 5)

This regression was found while trying to run the test suite of the
LysKOM server.  I've checked in a less simplified test case here:

https://git.lysator.liu.se/lyskom-server/lyskom-server/blobs/master/src/server/testsuite/dejagnu.0/01-long-regexp.exp

The real code is buried inside this DejaGnu testsuite:

https://git.lysator.liu.se/lyskom-server/lyskom-server/blobs/master/src/server/testsuite/lyskomd.0/03.exp

(I'm only anonymous because a five-minute search didn't reveal how to
create an account here.  I'm Per Cederqvist <[email protected]>.)
Referenced by1
  • b7100ded1f[1905562] [8d2c0da36d] Raise the recursion limits on regexps to allow existing regexps "in the wild" to continue working with Tcl 8.6. Latest example comes from DejaGnu. check-in2013-08-01 19:18:02
dgpplain2013-08-01 17:02:59
Bisecting points the source of this regression
as:

http://core.tcl.tk/tcl/info/1ab85d8c7d

This change came from dkf, and is an intentional
limiting, but the comment suggests that further
tuning may be needed.  Here's a use case from
in the field to guide that tuning.

assigned to dkf for more assessment.
dgpplain2013-08-01 17:36:44
Better place to track this is
http://core.tcl.tk/tcl/tktview/1905562

Closing this as a Duplicate.
Log in (anonymous is fine) to add a comment.