unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#7736: 24.0.50; perl-mode infinite loop
@ 2010-12-25 13:41 jidanni
  2011-01-23  1:18 ` Chong Yidong
  2011-01-24 20:13 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: jidanni @ 2010-12-25 13:41 UTC (permalink / raw)
  To: 7736; +Cc: rfrancoise

[-- Attachment #1: Type: text/plain, Size: 48 bytes --]

Man, you gotta see this. On this attached file,

[-- Attachment #2: test file --]
[-- Type: text/x-perl, Size: 978 bytes --]

#!/usr/bin/perl
# Print all tw.myblog.yahoo.com subscriptions URLs from a given URL
# Copyright       : http://www.fsf.org/copyleft/gpl.html
# Author          : Dan Jacobson -- http://jidanni.org/
# Created On      : Sun Dec 19 21:41:47 2010
# Last Modified On: Sat Dec 25 10:31:18 2010
# Update Count    : 58
use warnings FATAL => 'all';
use strict;
use utf8;
use open qw/:std :encoding(utf8)/;
use WWW::Mechanize;
my $mech = WWW::Mechanize->new( autocheck => 1 );
$mech->get(@ARGV);
my %blogs;
do { get_all_blogs_on_this_page() }
  while ( $mech->find_link( text_regex => qr'下一頁' ) # $ maybe added by my wwwoffle
    && $mech->follow_link( text_regex => qr'下一頁' ) );
print "$_\n" for sort keys %blogs;

sub get_all_blogs_on_this_page {
    for ( $mech->find_all_links( tag => "a", text => '詳全文' ) ) {
	$_->url =~ shttp://tw.myblog.yahoo.com/jw!3tU21_aCAh6NNGlBu.pqLpgW/subscription?fid=3&page=6
        $blogs{ $_->url }++;
    }
}

[-- Attachment #3: Type: text/plain, Size: 747 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#7736: 24.0.50; perl-mode infinite loop
  2010-12-25 13:41 bug#7736: 24.0.50; perl-mode infinite loop jidanni
@ 2011-01-23  1:18 ` Chong Yidong
  2011-01-24  0:53   ` Stefan Monnier
  2011-01-24 20:13 ` Stefan Monnier
  1 sibling, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2011-01-23  1:18 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: jidanni, rfrancoise, 7736

jidanni@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@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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#7736: 24.0.50; perl-mode infinite loop
  2011-01-23  1:18 ` Chong Yidong
@ 2011-01-24  0:53   ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2011-01-24  0:53 UTC (permalink / raw)
  To: Chong Yidong; +Cc: jidanni, rfrancoise, 7736

>> 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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#7736: 24.0.50; perl-mode infinite loop
  2010-12-25 13:41 bug#7736: 24.0.50; perl-mode infinite loop jidanni
  2011-01-23  1:18 ` Chong Yidong
@ 2011-01-24 20:13 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2011-01-24 20:13 UTC (permalink / raw)
  To: jidanni; +Cc: rfrancoise, 7736-done

> 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






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-24 20:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-25 13:41 bug#7736: 24.0.50; perl-mode infinite loop jidanni
2011-01-23  1:18 ` Chong Yidong
2011-01-24  0:53   ` Stefan Monnier
2011-01-24 20:13 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).