From geoffgole@gmail.com Wed Jan 21 15:30:43 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 21 Jan 2009 23:30:43 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=0.1 required=4.0 tests=FOURLA,MURPHY_DRUGS_REL8 autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0LNUeXG006280 for ; Wed, 21 Jan 2009 15:30:41 -0800 Received: from mail.gnu.org ([199.232.76.166]:48645 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1LPmVR-00017l-9C for emacs-pretest-bug@gnu.org; Wed, 21 Jan 2009 18:29:09 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1LPmWs-00084P-F6 for emacs-pretest-bug@gnu.org; Wed, 21 Jan 2009 18:30:39 -0500 Received: from wa-out-1112.google.com ([209.85.146.176]:20310) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LPmWr-00084B-V9 for emacs-pretest-bug@gnu.org; Wed, 21 Jan 2009 18:30:38 -0500 Received: by wa-out-1112.google.com with SMTP id j32so2286005waf.26 for ; Wed, 21 Jan 2009 15:30:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=/LCJq/3NEyKy7Tn8JAJmdxETfVhaqQft5PD8GzlcOQI=; b=p63uxpZR6ycpJ+KXpavoUjzjHPnA6UPOt2FX9KQJdM6+v8j9TjruNN6ZgO1287PwOT 9UjoLWSNipc4a4WA3T30oNSdpAf15m3Ajlf8q/k/8vB5tMsvhJmZ2xmxd6GflfEMBWW0 XHUOI3c8PdWrk4HRUoVG7GNfcTVVa078xYu1o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=YIin2ZqeOIvwDEi+GCNUS3XzopZwfxKJ0XzERnyU+Py1P9GmTUF5czYIUF8yTRcYD9 pq4WVhqHCGiOoTYAZz56hIyiStUqLam743STVr00qbP9EnJ8MFdeIVGuPkxtY4iMT6qw x+9wACE6f/osb8MBoyuGOeDfI+JvHXID7uMik= MIME-Version: 1.0 Received: by 10.114.80.1 with SMTP id d1mr2094038wab.168.1232580636566; Wed, 21 Jan 2009 15:30:36 -0800 (PST) Date: Thu, 22 Jan 2009 08:30:36 +0900 Message-ID: Subject: 23.0.60; Infinite loop in align-regexp From: Geoff Gole To: emacs-pretest-bug@gnu.org Content-Type: multipart/mixed; boundary=0016364175d9ffe55b0461068a1c X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) --0016364175d9ffe55b0461068a1c Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit This was originally sent to emacs-devel. Since it's been a week with no response I'm going to assume that that was the wrong place, thus I'm copying it here. My apologies if the duplication is inappropriate. For certain choices of regexp and region text, align-regexp will enter an infinite loop. To reproduce: emacs -Q RET foo C-SPC C-a M-x align-regexp \< Note that the infinite loop won't occur for text at the beginning of the buffer, so make sure to test at least one newline down. I'm suprised that this hasn't come up before. I would have thought aligning to beginning-of-word would be a common case. Anyway, the problem seems to be that align-region assumes that a successful search will always move point forward. The following patch attempts to fix this: --- /home/ggole/src/emacs/lisp/align.el 2009-01-05 12:18:39.000000000 +0900 +++ loopfix-align.el 2009-01-22 08:15:59.000000000 +0900 @@ -1307,6 +1307,7 @@ (rulesep (assq 'separate rule)) (thissep (if rulesep (cdr rulesep) separate)) same (eol 0) + search-origin group group-c spacing spacing-c tab-stop tab-stop-c @@ -1412,6 +1413,7 @@ ;; while we can find the rule in the alignment ;; region.. (while (and (< (point) end-mark) + (setq search-origin (point)) (if regfunc (funcall regfunc end-mark nil) (re-search-forward regexp @@ -1436,7 +1438,8 @@ ;; if the search ended us on the beginning of ;; the next line, move back to the end of the ;; previous line. - (if (bolp) + (if (and (bolp) + (> (point) search-origin)) (forward-char -1)) ;; lookup the `group' attribute the first time @@ -1576,7 +1579,12 @@ ;; the next line; don't bother searching ;; anymore on this one (if (and (not repeat) (not (bolp))) - (forward-line))))) + (forward-line)) + + ;; if the search did not change point, + ;; move forward to avoid an infinite loop + (if (= (point) search-origin) + (forward-char))))) ;; when they are no more matches for this rule, ;; align whatever was left over --0016364175d9ffe55b0461068a1c Content-Type: text/x-patch; charset=US-ASCII; name="align-regexp-loopfix.diff" Content-Disposition: attachment; filename="align-regexp-loopfix.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_fq8mheb00 LS0tIC9ob21lL2dnb2xlL3NyYy9lbWFjcy9saXNwL2FsaWduLmVsCTIwMDktMDEtMDUgMTI6MTg6 MzkuMDAwMDAwMDAwICswOTAwCisrKyBsb29wZml4LWFsaWduLmVsCTIwMDktMDEtMjIgMDg6MTU6 NTkuMDAwMDAwMDAwICswOTAwCkBAIC0xMzA3LDYgKzEzMDcsNyBAQAogCQkgKHJ1bGVzZXAgKGFz c3EgJ3NlcGFyYXRlIHJ1bGUpKQogCQkgKHRoaXNzZXAgKGlmIHJ1bGVzZXAgKGNkciBydWxlc2Vw KSBzZXBhcmF0ZSkpCiAJCSBzYW1lIChlb2wgMCkKKwkJIHNlYXJjaC1vcmlnaW4KIAkJIGdyb3Vw IGdyb3VwLWMKIAkJIHNwYWNpbmcgc3BhY2luZy1jCiAJCSB0YWItc3RvcCB0YWItc3RvcC1jCkBA IC0xNDEyLDYgKzE0MTMsNyBAQAogCQkgICAgICA7OyB3aGlsZSB3ZSBjYW4gZmluZCB0aGUgcnVs ZSBpbiB0aGUgYWxpZ25tZW50CiAJCSAgICAgID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naW4pCisJCQkJKGZvcndhcmQtY2hhcikp KSkpCiAKIAkJICAgICAgOzsgd2hlbiB0aGV5IGFyZSBubyBtb3JlIG1hdGNoZXMgZm9yIHRoaXMg cnVsZSwKIAkJICAgICAgOzsgYWxpZ24gd2hhdGV2ZXIgd2FzIGxlZnQgb3Zlcgo= --0016364175d9ffe55b0461068a1c-- From cyd@stupidchicken.com Sat Jan 24 15:43:39 2009 Received: (at 1982-done) by emacsbugs.donarmstrong.com; 24 Jan 2009 23:43:40 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=0.0 required=4.0 tests=MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0ONhbTI016933 for <1982-done@emacsbugs.donarmstrong.com>; Sat, 24 Jan 2009 15:43:38 -0800 Received: by cyd.mit.edu (Postfix, from userid 1000) id EEF6057E196; Sat, 24 Jan 2009 18:44:04 -0500 (EST) From: Chong Yidong To: Geoff Gole Cc: 1982-done@debbugs.gnu.org Subject: Re: 23.0.60; Infinite loop in align-regexp Date: Sat, 24 Jan 2009 18:44:04 -0500 Message-ID: <87y6x0w9q3.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > For certain choices of regexp and region text, align-regexp will enter > an infinite loop... Anyway, the problem seems to be that align-region > assumes that a successful search will always move point forward. The > following patch attempts to fix this: Your patch looks OK, so I've checked it in. Thanks very much. From unknown Fri Aug 15 03:56:58 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: $requester Subject: Internal Control Message-Id: bug archived. Date: Sun, 22 Feb 2009 15:24:05 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A log time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 25 18:09:13 2010 Received: (at control) by debbugs.gnu.org; 25 Jan 2010 23:09:13 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NZY3T-00080e-Bp for submit@debbugs.gnu.org; Mon, 25 Jan 2010 18:09:13 -0500 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NZY3R-00080Z-GC for control@debbugs.gnu.org; Mon, 25 Jan 2010 18:09:09 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.69) (envelope-from ) id 1NZY3N-0001rb-MZ; Mon, 25 Jan 2010 18:09:05 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <19294.9361.597434.290863@fencepost.gnu.org> Date: Mon, 25 Jan 2010 18:09:05 -0500 From: Glenn Morris To: control Subject: control X-Attribution: GM X-Mailer: VM (www.wonderworks.com/vm), GNU Emacs (www.gnu.org/software/emacs) X-Hue: cyan X-Ran: ]Vs^BnQ:)I3;cKQqWxKp@TGK'E]LM(//C2_\bp!Z2?_2a-3VCDk#4X2:43E"]wIG9nlSf5 X-Debbugs-No-Ack: yes X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) close 2709 unarchive 2761 unarchive 2722 merge 2722 2761 tags 2783 patch unarchive 2786 unarchive 1982 merge 1982 2786 From unknown Fri Aug 15 03:56:58 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 23 Feb 2010 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A long time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator