From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Schwab Newsgroups: gmane.emacs.bugs Subject: bug#7227: re-search-forward goes infinite loop with dash inside [] Date: Sat, 16 Oct 2010 15:54:17 +0200 Message-ID: References: <1213200935.4147.62.camel@cyberelk.elk> <87eibqp847.fsf_-_@picasso.cante.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1287238822 2212 80.91.229.12 (16 Oct 2010 14:20:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 16 Oct 2010 14:20:22 +0000 (UTC) Cc: 7227@debbugs.gnu.org To: Jari Aalto Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 16 16:20:21 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P77cS-0001RZ-7U for geb-bug-gnu-emacs@m.gmane.org; Sat, 16 Oct 2010 16:20:20 +0200 Original-Received: from localhost ([127.0.0.1]:45002 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P77cR-0004PB-Gc for geb-bug-gnu-emacs@m.gmane.org; Sat, 16 Oct 2010 10:20:19 -0400 Original-Received: from [140.186.70.92] (port=48441 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P77VA-0001ws-I2 for bug-gnu-emacs@gnu.org; Sat, 16 Oct 2010 10:13:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P77Ul-0005I8-D7 for bug-gnu-emacs@gnu.org; Sat, 16 Oct 2010 10:12:47 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39170) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P77Ul-0005I3-B2 for bug-gnu-emacs@gnu.org; Sat, 16 Oct 2010 10:12:23 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1P77A5-00006r-R6; Sat, 16 Oct 2010 09:51:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andreas Schwab Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Oct 2010 13:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7227 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 7227-submit@debbugs.gnu.org id=B7227.1287237043413 (code B ref 7227); Sat, 16 Oct 2010 13:51:01 +0000 Original-Received: (at 7227) by debbugs.gnu.org; 16 Oct 2010 13:50:43 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P779m-00006c-Rf for submit@debbugs.gnu.org; Sat, 16 Oct 2010 09:50:43 -0400 Original-Received: from mail-out.m-online.net ([212.18.0.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P779k-00006V-9R for 7227@debbugs.gnu.org; Sat, 16 Oct 2010 09:50:41 -0400 Original-Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 8B52C1C00108; Sat, 16 Oct 2010 15:54:17 +0200 (CEST) Original-Received: from igel.home (ppp-93-104-129-199.dynamic.mnet-online.de [93.104.129.199]) by mail.mnet-online.de (Postfix) with ESMTP id 6F71A1C002F1; Sat, 16 Oct 2010 15:54:17 +0200 (CEST) Original-Received: by igel.home (Postfix, from userid 501) id 3F10ACA2A0; Sat, 16 Oct 2010 15:54:17 +0200 (CEST) X-Yow: I think I'll make SCRAMBLED EGGS!! They're each in LITTLE SHELLS.. In-Reply-To: <87eibqp847.fsf_-_@picasso.cante.net> (Jari Aalto's message of "Sat, 16 Oct 2010 16:42:00 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 16 Oct 2010 09:51:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:40924 Archived-At: Jari Aalto writes: > Hm. The test case needs adjustment: > > ;; (1) Run C-x C-e, works: > > (re-search-forward "^\\([a-z0-9.-]+\\)+[ \t]+\\([0-9]+\\) +\\([a-z].*\\)") > row2 1234 rest of line > > ;; (2) but C-x C-e below causes a loop > > (re-search-forward "^\\([a-z0-9.-]+\\)+[ \t]+\\([0-9]+\\) +\\([a-z].*\\)") > ------------------------------------------------------------------------ > row2 1234 rest of line > >> Note that nested repetitions like \([...]+\)+ are bad in any case. > > This was only a test. The anchor "^" should help, and I assume the first > '[a-z0-9.-]+' should be greedy, so it shouldn't take that long to > resolve. Not in the non-matching case. When the match against the dash line is tried you get quadratic behaviour due to explosion of the search tree. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."