GNU bug report logs - #7736
24.0.50; perl-mode infinite loop

Previous Next

Package: emacs;

Reported by: jidanni <at> jidanni.org

Date: Sun, 26 Dec 2010 00:19:01 UTC

Severity: normal

Found in version 24.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

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 7736 in the body.
You can then email your comments to 7736 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, rfrancoise <at> debian.org, bug-gnu-emacs <at> gnu.org:
bug#7736; Package emacs. (Sun, 26 Dec 2010 00:19:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to jidanni <at> jidanni.org:
New bug report received and forwarded. Copy sent to rfrancoise <at> debian.org, bug-gnu-emacs <at> gnu.org. (Sun, 26 Dec 2010 00:19:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: jidanni <at> jidanni.org
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.50; perl-mode infinite loop
Date: Sat, 25 Dec 2010 21:41:26 +0800
[Message part 1 (text/plain, inline)]
Man, you gotta see this. On this attached file,
[r.pl (text/x-perl, attachment)]
[Message part 3 (text/plain, inline)]
save in /tmp, and run emacs -Q -nw /tmp/r.pl

Now move the cursor down and attempt to change shttp to s[http .
As you insert the [ an infinite loop begins.
You probably can break out with a C-g, but you might need a
$ killall -HUP emacs

In GNU Emacs 24.0.50.1 (i486-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2010-12-14 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20101212-2)

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: C
  value of $LC_CTYPE: zh_TW.UTF-8
  value of $LC_MESSAGES: C
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: C
  value of $LANG: zh_TW.UTF-8
  value of $XMODIFIERS: @im=SCIM
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7736; Package emacs. (Sun, 23 Jan 2011 01:11:02 GMT) Full text and rfc822 format available.

Message #8 received at 7736 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 7736 <at> debbugs.gnu.org, rfrancoise <at> debian.org, jidanni <at> jidanni.org
Subject: Re: bug#7736: 24.0.50; perl-mode infinite loop
Date: Sat, 22 Jan 2011 20:18:34 -0500
jidanni <at> jidanni.org writes:

> Man, you gotta see this. On this attached file,
>
> save in /tmp, and run emacs -Q -nw /tmp/r.pl
>
> Now move the cursor down and attempt to change shttp to s[http .
> As you insert the [ an infinite loop begins.

This bug was apparently introduced by syntax-propertize on the trunk.
Stefan, could you take a look?

2010-09-10  Stefan Monnier  <monnier <at> iro.umontreal.ca>

   * progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
   replace perl-font-lock-syntactic-keywords.
   (perl-syntax-propertize-special-constructs): New fun to replace
   perl-font-lock-special-syntactic-constructs.
   (perl-font-lock-syntactic-face-function): New fun.
   (perl-mode): Use it.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7736; Package emacs. (Mon, 24 Jan 2011 00:46:02 GMT) Full text and rfc822 format available.

Message #11 received at 7736 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 7736 <at> debbugs.gnu.org, rfrancoise <at> debian.org, jidanni <at> jidanni.org
Subject: Re: bug#7736: 24.0.50; perl-mode infinite loop
Date: Sun, 23 Jan 2011 19:53:04 -0500
>> Man, you gotta see this. On this attached file,
>> save in /tmp, and run emacs -Q -nw /tmp/r.pl
>> Now move the cursor down and attempt to change shttp to s[http .
>> As you insert the [ an infinite loop begins.
> This bug was apparently introduced by syntax-propertize on the trunk.
> Stefan, could you take a look?

Sure (as well as the ruby one),


        Stefan




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Mon, 24 Jan 2011 20:08:02 GMT) Full text and rfc822 format available.

Notification sent to jidanni <at> jidanni.org:
bug acknowledged by developer. (Mon, 24 Jan 2011 20:08:02 GMT) Full text and rfc822 format available.

Message #16 received at 7736-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: jidanni <at> jidanni.org
Cc: rfrancoise <at> debian.org, 7736-done <at> debbugs.gnu.org
Subject: Re: bug#7736: 24.0.50; perl-mode infinite loop
Date: Mon, 24 Jan 2011 15:13:07 -0500
> Man, you gotta see this. On this attached file,
> save in /tmp, and run emacs -Q -nw /tmp/r.pl

> Now move the cursor down and attempt to change shttp to s[http .
> As you insert the [ an infinite loop begins.

Indeed, thanks for that test case.  I've installed the patch below
which should fix the problem.


        Stefan


=== modified file 'lisp/progmodes/perl-mode.el'
--- lisp/progmodes/perl-mode.el	2011-01-14 17:18:41 +0000
+++ lisp/progmodes/perl-mode.el	2011-01-24 20:05:18 +0000
@@ -360,7 +360,8 @@
      (t
       ;; This is regexp like quote thingy.
       (setq char (char-after (nth 8 state)))
-      (let ((twoargs (save-excursion
+      (let ((startpos (point))
+            (twoargs (save-excursion
                        (goto-char (nth 8 state))
                        (skip-syntax-backward " ")
                        (skip-syntax-backward "w")
@@ -384,7 +385,8 @@
 			  (goto-char (1+ (nth 8 state)))
 			  (up-list 1)
 			  t)
-		      (scan-error nil))
+                      ;; In case of error, make sure we don't move backward.
+		      (scan-error (goto-char startpos) nil))
 		  (not (or (nth 8 (parse-partial-sexp
 				   (point) limit nil nil state 'syntax-table))
 			   ;; If we have a self-paired opener and a twoargs





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 22 Feb 2011 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 118 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.