diff -u expect-5.44.1.15/debian/changelog expect-5.44.1.15/debian/changelog
--- expect-5.44.1.15/debian/changelog
+++ expect-5.44.1.15/debian/changelog
@@ -1,3 +1,14 @@
+expect (5.44.1.15-3) unstable; urgency=low
+
+  * Added patch by upstream (proposed by Per Cederqvist) which fixes
+    slow processing of certain regexp patterns by preventing their
+    convertation to glob patterns (closes: #591695).
+  * Don't load Expect package to tclsh 8.4 because it causes a
+    segmentation fault.
+  * Updated package to standards version 3.9.1 (no changes needed).
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sun, 05 Sep 2010 09:48:27 +0400
+
 expect (5.44.1.15-2) unstable; urgency=low
 
   * Removed a bit of implicit-declarations patch which included tcl.h into
diff -u expect-5.44.1.15/debian/control expect-5.44.1.15/debian/control
--- expect-5.44.1.15/debian/control
+++ expect-5.44.1.15/debian/control
@@ -5,7 +5,7 @@
 Build-Depends: debhelper (>= 7.0.50~), quilt (>=0.46-7), autotools-dev, autoconf,
  tcl8.5-dev, tk8.5-dev (>= 8.5.7-2)
 Build-Conflicts: autoconf2.13
-Standards-Version: 3.9.0
+Standards-Version: 3.9.1
 Homepage: http://sourceforge.net/projects/expect/
 
 Package: expect
diff -u expect-5.44.1.15/debian/patches/06-pkgindex.patch expect-5.44.1.15/debian/patches/06-pkgindex.patch
--- expect-5.44.1.15/debian/patches/06-pkgindex.patch
+++ expect-5.44.1.15/debian/patches/06-pkgindex.patch
@@ -8,21 +8,27 @@
 
 --- expect-5.44.1.15.orig/Makefile.in
 +++ expect-5.44.1.15/Makefile.in
-@@ -331,7 +331,7 @@
+@@ -330,8 +330,10 @@
+ 	( echo pkg_mkIndex . $(PKG_LIB_FILE) \; exit; ) | $(TCLSH)
  
  pkgIndex.tcl-hand:
- 	(echo 'package ifneeded Expect $(PACKAGE_VERSION) \
+-	(echo 'package ifneeded Expect $(PACKAGE_VERSION) \
 -	    [list load [file join $$dir $(PKG_LIB_FILE)]]'\
++	(echo 'if {[package vcompare [info tclversion] @TCL_VERSION@] < 0} return' ; \
++	 echo '' ; \
++	 echo 'package ifneeded Expect $(PACKAGE_VERSION) \
 +	    [list load [file join @prefix@ lib libexpect.so.@PACKAGE_VERSION@]]'\
  	) > pkgIndex.tcl
  
  #========================================================================
 --- expect-5.44.1.15.orig/pkgIndex.in
 +++ expect-5.44.1.15/pkgIndex.in
-@@ -7,4 +7,4 @@
+@@ -7,4 +7,6 @@
  # script is sourced, the variable $dir must contain the
  # full path name of this file's directory.
  
++if {[package vcompare [info tclversion] @TCL_VERSION@] < 0} return
++
 -package ifneeded Expect @EXP_VERSION_FULL@ [list load [file join $dir .. @EXP_SHARED_LIB_FILE@]]
 +package ifneeded Expect @EXP_VERSION_FULL@ [list load [file join @prefix@ lib libexpect.so.@PACKAGE_VERSION@]]
 --- expect-5.44.1.15.orig/tests/cat.test
diff -u expect-5.44.1.15/debian/patches/series expect-5.44.1.15/debian/patches/series
--- expect-5.44.1.15/debian/patches/series
+++ expect-5.44.1.15/debian/patches/series
@@ -16,0 +17 @@
+20-two-asterisks.patch
only in patch2:
unchanged:
--- expect-5.44.1.15.orig/debian/patches/20-two-asterisks.patch
+++ expect-5.44.1.15/debian/patches/20-two-asterisks.patch
@@ -0,0 +1,70 @@
+Author: Upstream (proposed by Per Cederqvist <ceder@lysator.liu.se>)
+Description: The patch fixes regression with very slow regexp pattern
+ processing which were converted into too complex glob patterns.
+ The regression was added in version 5.44.
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=591695
+Bug-Upstream: http://sourceforge.net/tracker/?func=detail&atid=113179&aid=3010684&group_id=13179
+Forwarded: no
+Last-updated: Sun, 05 Sep 2010 09:35:03 +0400
+
+--- expect-5.44.1.15.orig/retoglob.c
++++ expect-5.44.1.15/retoglob.c
+@@ -34,6 +34,10 @@
+ 			 Tcl_UniChar* str,
+ 			 int          strlen));
+ 
++static int
++ExpCountStar _ANSI_ARGS_ ((Tcl_UniChar* src, Tcl_UniChar* last));
++
++
+ static char*
+ xxx (Tcl_UniChar* x, int xl)
+ {
+@@ -465,6 +469,15 @@
+   LOG (stderr,"ST '%s'\n",xxx(out,nexto-out)); FF;
+ 
+   /*
++   * Heuristic: if there are more than two *s, the risk is far too
++   * large that the result actually is slower than the normal re
++   * matching.  So bail out.
++   */
++  if (ExpCountStar (out,nexto) > 2) {
++      goto error;
++  }
++
++  /*
+    * Check if the result is actually useful.
+    * Empty or just a *, or ? are not. A series
+    * of ?'s is borderline, as they semi-count
+@@ -717,6 +730,31 @@
+   return dst;
+ }
+ 
++static int
++ExpCountStar (src, last)
++    Tcl_UniChar* src;
++    Tcl_UniChar* last;
++{
++    int skip = 0;
++    int stars = 0;
++
++    /* Count number of *'s. State machine. The complexity is due to the
++     * need of handling escaped characters.
++     */
++
++    for (; src < last; src++) {
++	if (skip) {
++	    skip = 0;
++	} else if (*src == '\\') {
++	    skip = 1;
++	} else if (*src == '*') {
++	    stars++;
++	}
++    }
++
++    return stars;
++}
++
+ #undef CHOP
+ #undef CHOPC
+ #undef EMIT
