all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* BUG 20703 further evidence
@ 2016-01-13 17:54 Sam Halliday
  2016-01-13 21:25 ` Dmitry Gutov
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ 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] 10+ messages in thread

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

Thread overview: 10+ 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-08-25 14:54     ` Drew Adams
2020-10-11  3:08     ` Lars Ingebrigtsen
2020-10-11  3:08     ` Lars Ingebrigtsen
2020-08-25  9:13   ` Lars Ingebrigtsen
2016-01-13 21:25 ` Dmitry Gutov
     [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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.