From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#20703: BUG 20703 further evidence Date: Thu, 14 Jan 2016 00:25:32 +0300 Message-ID: <5696C0CC.9010300__38775.2372459092$1452720382$gmane$org@yandex.ru> References: <5ab4af6b-5b7d-40f9-b49f-2d8cc6926e9f@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1452720382 5142 80.91.229.3 (13 Jan 2016 21:26:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Jan 2016 21:26:22 +0000 (UTC) Cc: 20703@debbugs.gnu.org To: Sam Halliday , help-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 13 22:26:11 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aJSvi-0004Y5-JY for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Jan 2016 22:26:10 +0100 Original-Received: from localhost ([::1]:39260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJSvi-00063n-0D for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Jan 2016 16:26:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJSve-00063S-CH for bug-gnu-emacs@gnu.org; Wed, 13 Jan 2016 16:26:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJSva-0001yq-4W for bug-gnu-emacs@gnu.org; Wed, 13 Jan 2016 16:26:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60394) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJSva-0001yl-1P for bug-gnu-emacs@gnu.org; Wed, 13 Jan 2016 16:26:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aJSvZ-0008CH-RK for bug-gnu-emacs@gnu.org; Wed, 13 Jan 2016 16:26:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Jan 2016 21:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20703 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20703-submit@debbugs.gnu.org id=B20703.145272034231484 (code B ref 20703); Wed, 13 Jan 2016 21:26:01 +0000 Original-Received: (at 20703) by debbugs.gnu.org; 13 Jan 2016 21:25:42 +0000 Original-Received: from localhost ([127.0.0.1]:48614 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aJSvG-0008Bk-Do for submit@debbugs.gnu.org; Wed, 13 Jan 2016 16:25:42 -0500 Original-Received: from mail-lb0-f169.google.com ([209.85.217.169]:34632) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aJSvD-0008BO-QN for 20703@debbugs.gnu.org; Wed, 13 Jan 2016 16:25:40 -0500 Original-Received: by mail-lb0-f169.google.com with SMTP id cl12so80763786lbc.1 for <20703@debbugs.gnu.org>; Wed, 13 Jan 2016 13:25:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:cc:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=W/QsqjsNA0/NpPpjT/cHOpwWD0uNPCLNB/NF+hW9hjQ=; b=Er6dZVOjHbQizmpoGU8biwkyds1PhXORFdoycWe75Uc74BfsW+pyQR6N5Y2T/FyNoz nM/fQUq/9FIgLcmUVuLPprFfg4axMN3r9csK6tuiNrXGI3fboqTd9rZ9YatwVQoC6JQi U+xEi3AToghesuebVrgtBh13aYTz++2rVL+Mmk0fYcmM9kxsMGE80x8QeNvxb9On0HpL maTN/DZPgcJT1lfJdeWoKw7FTS/XLZwTGsC367bLWMx9XZhiDvqQiopC+j1gYLtkt535 lh0U1+6qRtMCsdZQD4tb9BqGKfDFth+bPeNUwRnVNCfVoVf9Tjav5Gc7cgwv79/z4uab L6Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:cc:message-id :date:user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=W/QsqjsNA0/NpPpjT/cHOpwWD0uNPCLNB/NF+hW9hjQ=; b=lG25p20hAHuw/SFCFH7u3i96YFHw+DdNtd8fw4b1ztSt2W5WM9C3Aa9MKogK35Mi9z OmvwqWeL88D/CvcLpHwdcuhGj2dwKR8DYZjmmwW7BEHzOWxGsn8rLsdU52VNciurXCvM SnT+a5svVxKRY3ANg6uZ5L1jQ4tO7Ft5/Qtsz0bFRxS8uzZ/QGK7Fh/bRb7eRzdvOO/r w/myxA5ApPbb3kmJbXpKRz4kEyycRoHURFmo22ja8/6OcdLJqXTVydq0qEumAs9UZBm+ 2VhcV0tf77v3c3eVoXQpOuRE8igfT4vy+oQNJKueqgsTlUrejthy1STAY+JDxYsAOfsu cJsg== X-Gm-Message-State: ALoCoQmDMu+Tj5PiOTgK4+BwH0LIiuAPTn8I7PymEPSZ51pefheS2k93ItRn8Mo7/vHNuBqa7jccTeASwIyJKN9ddyJctZzkaw== X-Received: by 10.112.13.193 with SMTP id j1mr168286lbc.24.1452720333937; Wed, 13 Jan 2016 13:25:33 -0800 (PST) Original-Received: from [192.168.1.190] ([178.252.127.222]) by smtp.googlemail.com with ESMTPSA id wj2sm400277lbb.5.2016.01.13.13.25.32 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Jan 2016 13:25:33 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:43.0) Gecko/20100101 Thunderbird/43.0 In-Reply-To: <5ab4af6b-5b7d-40f9-b49f-2d8cc6926e9f@googlegroups.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:111598 Archived-At: Hi Sam, On 01/13/2016 08:54 PM, Sam Halliday wrote: > 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. You should try the current version in emacs-25, it's smaller and faster than previously, although it also probably fails at long-enough lines. > 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. I can think of some other possible solutions: - External pre-processor that removes lines that are too long. - Extra step, together with a custom variable, in visit-tags-table, that goes through the opened files and does the same. - re-search-forward with limit, as implemented in the patch below (against emacs-25), that might work against problematic files like that (I haven't tested it). I don't really know if we should install it, though, because it adds a performance overhead of ~10%. And I don't know if this problem is common enough. Because another way to combat it is at the source: through judicious application of --exclude argument. As a bonus, the generation phase will become faster as well (sometimes dramatically). Should we add a validation phase to visit-tags-table instead? Like, one that would say "your TAGS files contains obviously malformed entries from file XXX.min.js, go back and ignore it"? diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 2db7220..9a663d4 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -1252,8 +1252,9 @@ etags-file-of-tag str (expand-file-name str (file-truename default-directory)))))) +(defvar etags--table-line-limit 500) -(defun etags-tags-completion-table () ; Doc string? +(defun etags-tags-completion-table () ; Doc string? (let (table (progress-reporter (make-progress-reporter @@ -1263,10 +1264,13 @@ etags-tags-completion-table (goto-char (point-min)) ;; This regexp matches an explicit tag name or the place where ;; it would start. - (while (re-search-forward - "[\f\t\n\r()=,; ]?\177\\\(?:\\([^\n\001]+\\)\001\\)?" - nil t) - (push (prog1 (if (match-beginning 1) + (while (not (eobp)) + (if (not (re-search-forward + "[\f\t\n\r()=,; ]?\177\\\(?:\\([^\n\001]+\\)\001\\)?" + ;; Avoid lines that are too long (bug#20703). + (+ (point) etags--table-line-limit) t)) + (forward-line 1) + (push (prog1 (if (match-beginning 1) ;; There is an explicit tag name. (buffer-substring (match-beginning 1) (match-end 1)) ;; No explicit tag name. Backtrack a little, @@ -1277,7 +1281,7 @@ etags-tags-completion-table (buffer-substring (point) (match-beginning 0)) (goto-char (match-end 0)))) (progress-reporter-update progress-reporter (point))) - table))) + table)))) table)) (defun etags-snarf-tag (&optional use-explicit) ; Doc string?