Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Jun 2013 18:35:06 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        tcltk@FreeBSD.org
Subject:   patch: increase tcl86 regular expression depth limit to help dejagnu
Message-ID:  <DF38771A-FFC5-4E92-B95A-24F13AB331B1@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

--Apple-Mail=_8ED3CD7C-CD2A-46A6-9388-0F4BFF18EB3B
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Hi,

When running the libffi test suite using dejagnu, I ran into the
following tcl86 error:

...
Running target unix
Using /usr/local/share/dejagnu/baseboards/unix.exp as board description =
file for target.
Using /usr/local/share/dejagnu/config/unix.exp as generic interface file =
for target.
Using ../../testsuite/config/default.exp as tool-and-target-specific =
interface file.
Running ../../testsuite/libffi.call/call.exp ...
ERROR: tcl error sourcing ../../testsuite/libffi.call/call.exp.
ERROR: couldn't compile regular expression pattern: out of memory
    while executing
"regexp $texttmp ${output}"
    (procedure "saved-dg-test" line 247)
    invoked from within
"saved-dg-test ../../testsuite/libffi.call/huge_struct.c {-O0 -W -Wall} =
{}"
    ("eval" body line 1)
    invoked from within
"eval saved-dg-test $args "
    (procedure "dg-test" line 6)
    invoked from within
"dg-test $testcase $flags ${default-extra-flags}"
    (procedure "dg-runtest" line 10)
    invoked from within
"dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W =
-Wall" """
    (file "../../testsuite/libffi.call/call.exp" line 24)
    invoked from within
"source ../../testsuite/libffi.call/call.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source ../../testsuite/libffi.call/call.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
Running ../../testsuite/libffi.special/special.exp ...

After some searching, I found this similar bug on Tcl's tracker:
=
<http://sourceforge.net/tracker/?func=3Ddetail&aid=3D3603557&group_id=3D10=
894&atid=3D110894>

The change that introduced the limit is here:
<http://core.tcl.tk/tcl/info/1ab85d8c7d>;

To make tcl86 work for the libffi tests, I simply doubled the limit from
500 to 1000, as in the attached diff.  Can you please consider adding
this to the tcl86 port?

-Dimitry

--Apple-Mail=_8ED3CD7C-CD2A-46A6-9388-0F4BFF18EB3B
Content-Disposition: attachment;
	filename=lang__tcl86-double-regex-depth-limit-1.diff
Content-Type: application/octet-stream;
	name="lang__tcl86-double-regex-depth-limit-1.diff"
Content-Transfer-Encoding: 7bit

Fix tcl out of memory failure when running dejagnu tests, similar to:

  Running target unix
  Using /usr/local/share/dejagnu/baseboards/unix.exp as board description file for target.
  Using /usr/local/share/dejagnu/config/unix.exp as generic interface file for target.
  Using ../../testsuite/config/default.exp as tool-and-target-specific interface file.
  Running ../../testsuite/libffi.call/call.exp ...
  ERROR: tcl error sourcing ../../testsuite/libffi.call/call.exp.
  ERROR: couldn't compile regular expression pattern: out of memory
      while executing
  "regexp $texttmp ${output}"
      (procedure "saved-dg-test" line 247)
      invoked from within
  "saved-dg-test ../../testsuite/libffi.call/huge_struct.c {-O0 -W -Wall} {}"
      ("eval" body line 1)
      invoked from within
  "eval saved-dg-test $args "
      (procedure "dg-test" line 6)
      invoked from within
  "dg-test $testcase $flags ${default-extra-flags}"
      (procedure "dg-runtest" line 10)
      invoked from within
  "dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" """
      (file "../../testsuite/libffi.call/call.exp" line 24)
      invoked from within
  "source ../../testsuite/libffi.call/call.exp"
      ("uplevel" body line 1)
      invoked from within
  "uplevel #0 source ../../testsuite/libffi.call/call.exp"
      invoked from within
  "catch "uplevel #0 source $test_file_name""
  Running ../../testsuite/libffi.special/special.exp ...

See also: 
<http://sourceforge.net/tracker/index.php?func=detail&aid=3603557&group_id=10894&atid=110894>;

Index: lang/tcl86/files/patch-generic-regc_nfa.c
===================================================================
--- lang/tcl86/files/patch-generic-regc_nfa.c	(revision 0)
+++ lang/tcl86/files/patch-generic-regc_nfa.c	(working copy)
@@ -0,0 +1,11 @@
+--- ../generic/regc_nfa.c.orig	2011-04-26 17:14:02.000000000 +0200
++++ ../generic/regc_nfa.c	2013-06-01 18:08:49.000000000 +0200
+@@ -759,7 +759,7 @@ duptraverse(
+      * Arbitrary depth limit. Needs tuning, but this value is sufficient to
+      * make all normal tests (not reg-33.14) pass.
+      */
+-#define DUPTRAVERSE_MAX_DEPTH 500
++#define DUPTRAVERSE_MAX_DEPTH 1000
+ 
+     if (depth++ > DUPTRAVERSE_MAX_DEPTH) {
+ 	NERR(REG_ESPACE);

--Apple-Mail=_8ED3CD7C-CD2A-46A6-9388-0F4BFF18EB3B--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DF38771A-FFC5-4E92-B95A-24F13AB331B1>