[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: regexp stack overflow



On Tue, Jan 31, 2006 at 04:35:11PM +0900, Katsumi Yamaoka wrote:

> it.  Could you send a Lisp backtrace?  To do that, run
> `M-x toggle-debug-on-error' before the error occurs, and include
> the contents of the "*Backtrace*" buffer in an email.

Thanks! I didn't know about toggle-debug-on-error.
Wow, it appears that TWiki is sending the entire page text as part of
the URL when submitting changes to a page:

  Debugger entered--Lisp error: (error "Stack overflow in regexp matcher")
    string-match("\\`\\(\\([^:/?#]+\\):\\)?\\(//\\([^/?#]*\\)\\)?\\([^?#]*\\)\\(\\?\\([^#]*\\)\\)?\\(#\\(.*\\)\\)?\\'" "http://wiki/bin/preview/Main/BigWikiPage?text=---%2B%20Big%20Wiki%20Page%0D%0A%0D%0A [and so on, tens of kb of text ]
    w3m-expand-url("http://wiki/bin/preview/Main/BigWikiPage?text= [same here]
    w3m-fontify-anchors()
    w3m-fontify()
    w3m-create-text-page("http://wiki/bin/preview/Main/BigWikiPage"; "text/html" "ISO-8859-1" #<buffer *w3m*>)
    ...

so wherever W3M-URL-COMPONENTS-REGEXP is used I get in trouble. One
could probably re-write this code so that it doesn't use a regexp.
However, maybe it's just a problem with my particular emacs version
(21.2.1) or even the text I'm trying to match:

http://lists.gnu.org/archive/html/emacs-pretest-bug/2004-11/msg00385.html

For now, I just added this nasty kludge, which works only for me of
course:

(defun w3m-expand-url (url &optional base)
  "Convert URL to the absolute address, and canonicalize it."
  (if (and (> (length url) 23)
	   (string= (substring url 0 23)
		    "http://wiki/bin/preview";))
      url
      (progn

      [ original function body goes here ]

      ))


Thanks for your help,
Silvio.