unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* BUG 20703 further evidence
@ 2016-01-13 17:54 Sam Halliday
  2016-01-13 21:25 ` Dmitry Gutov
       [not found] ` <mailman.2317.1452720341.843.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Sam Halliday @ 2016-01-13 17:54 UTC (permalink / raw)
  To: help-gnu-emacs

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


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

end of thread, other threads:[~2020-10-11  3:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-13 17:54 BUG 20703 further evidence Sam Halliday
2016-01-13 21:25 ` Dmitry Gutov
2020-08-25  9:13   ` bug#20703: " Lars Ingebrigtsen
2020-10-11  3:08     ` Lars Ingebrigtsen
     [not found] ` <mailman.2317.1452720341.843.help-gnu-emacs@gnu.org>
2016-01-13 21:36   ` Sam Halliday
2016-01-13 21:50     ` Dmitry Gutov

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