help-gnu-emacs
[Top][All Lists]
Advanced

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

BUG 20703 further evidence


From: Sam Halliday
Subject: BUG 20703 further evidence
Date: Wed, 13 Jan 2016 09:54:48 -0800 (PST)
User-agent: G2/1.0

Hi all,

I have been seeing a problem that is described in this bug report

  https://debbugs.gnu.org/db/20/20703.html

I have applied the suggested patch to etags-tags-completion-table (copied below 
in completeness for your convenience) and trapped an error case.

I'm triggering the error in an extremely long line of code (46,000 
characters!). I presume somebody programmatically generated the line and pasted 
it into the source. A workaround could be to simply filter such lines at the 
ctag building or loading stage, just something that deletes "long" lines, 
whatever that may mean. Probably 500 characters is long enough!

I could also look at adding maximum sizes to my regexes in ctags, but that 
really isn't a general solution because many ctags patterns do not have such 
limits.


(defun etags-tags-completion-table () ; Doc string?
  (let ((table (make-vector 511 0))
        (progress-reporter
         (make-progress-reporter
          (format "Making tags completion table for %s..." buffer-file-name)
          (point-min) (point-max))))
    (save-excursion
      (goto-char (point-min))
      ;; This monster regexp matches an etags tag line.
      ;;   \1 is the string to match;
      ;;   \2 is not interesting;
      ;;   \3 is the guessed tag name; XXX guess should be better eg DEFUN
      ;;   \4 is not interesting;
      ;;   \5 is the explicitly-specified tag name.
      ;;   \6 is the line to start searching at;
      ;;   \7 is the char to start searching at.
      (condition-case err
          (while (re-search-forward
                  "^\\(\\([^\177]+[^-a-zA-Z0-9_+*$:\177]+\\)?\
\\([-a-zA-Z0-9_+*$?:]+\\)[^-a-zA-Z0-9_+*$?:\177]*\\)\177\
\\(\\([^\n\001]+\\)\001\\)?\\([0-9]+\\)?,\\([0-9]+\\)?\n"
                  nil t)
            (intern     (prog1 (if (match-beginning 5)
                               ;; There is an explicit tag name.
                               (buffer-substring (match-beginning 5) (match-end 
5))
                             ;; No explicit tag name.  Best guess.
                             (buffer-substring (match-beginning 3) (match-end 
3)))
                      (progress-reporter-update progress-reporter (point)))
                    table))
          (error
           (message "error happened near %d" (point))
           (error (error-message-string err)))))
      table))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]