GNU bug report logs -
#1982
23.0.60; Infinite loop in align-regexp
Previous Next
Reported by: Geoff Gole <geoffgole <at> gmail.com>
Date: Wed, 21 Jan 2009 23:40:03 UTC
Severity: normal
Merged with 2786
Done: Chong Yidong <cyd <at> stupidchicken.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1982 in the body.
You can then email your comments to 1982 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1982
; Package
emacs
.
(Wed, 21 Jan 2009 23:40:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Geoff Gole <geoffgole <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Wed, 21 Jan 2009 23:40:04 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
[Message part 1 (text/plain, inline)]
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
[align-regexp-loopfix.diff (text/x-patch, attachment)]
Reply sent
to
Chong Yidong <cyd <at> stupidchicken.com>
:
You have taken responsibility.
(Sat, 24 Jan 2009 23:50:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
Geoff Gole <geoffgole <at> gmail.com>
:
bug acknowledged by developer.
(Sat, 24 Jan 2009 23:50:03 GMT)
Full text and
rfc822 format available.
Message #10 received at 1982-done <at> emacsbugs.donarmstrong.com (full text, mbox):
> 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.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> emacsbugs.donarmstrong.com
.
(Sun, 22 Feb 2009 15:24:05 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Mon, 25 Jan 2010 23:10:03 GMT)
Full text and
rfc822 format available.
Merged 1982 2786.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Mon, 25 Jan 2010 23:10:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <bug-gnu-emacs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 23 Feb 2010 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 15 years and 176 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.