From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#22983: syntax-ppss returns wrong result. Date: Thu, 7 Sep 2017 17:56:14 +0000 Message-ID: <20170907175614.GB4488@ACM> References: <44b4fa9e-ec8e-98a4-d8ad-e799fffa7959@yandex.ru> <20160319122759.GA2644@acm.fritz.box> <9f36a39b-ea9f-2f61-5400-68de18526ab1@yandex.ru> <9fc66395-045c-1984-f530-033c2ff706f6@yandex.ru> <83h8wlz1kf.fsf@gnu.org> <20170902174027.GB4267@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1504807319 26584 195.159.176.226 (7 Sep 2017 18:01:59 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 7 Sep 2017 18:01:59 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: jwiegley@gmail.com, Philipp Stephani , 22983@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 07 20:01:45 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dq175-0005B2-00 for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Sep 2017 20:01:15 +0200 Original-Received: from localhost ([::1]:41591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq17C-0002tH-5r for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Sep 2017 14:01:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34467) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq170-0002pe-6F for bug-gnu-emacs@gnu.org; Thu, 07 Sep 2017 14:01:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq16s-000410-D4 for bug-gnu-emacs@gnu.org; Thu, 07 Sep 2017 14:01:10 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45946) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dq16s-00040v-9R for bug-gnu-emacs@gnu.org; Thu, 07 Sep 2017 14:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dq16r-0007hs-Uu for bug-gnu-emacs@gnu.org; Thu, 07 Sep 2017 14:01:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Sep 2017 18:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22983-submit@debbugs.gnu.org id=B22983.150480725329601 (code B ref 22983); Thu, 07 Sep 2017 18:01:01 +0000 Original-Received: (at 22983) by debbugs.gnu.org; 7 Sep 2017 18:00:53 +0000 Original-Received: from localhost ([127.0.0.1]:54627 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dq16i-0007hN-Jf for submit@debbugs.gnu.org; Thu, 07 Sep 2017 14:00:52 -0400 Original-Received: from ocolin.muc.de ([193.149.48.4]:17798 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1dq16g-0007hE-JE for 22983@debbugs.gnu.org; Thu, 07 Sep 2017 14:00:51 -0400 Original-Received: (qmail 82880 invoked by uid 3782); 7 Sep 2017 18:00:49 -0000 Original-Received: from acm.muc.de (p548C7C68.dip0.t-ipconnect.de [84.140.124.104]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 07 Sep 2017 20:00:48 +0200 Original-Received: (qmail 4807 invoked by uid 1000); 7 Sep 2017 17:56:14 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de 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" Xref: news.gmane.org gmane.emacs.bugs:136662 Archived-At: Hello, Dmitry. On Tue, Sep 05, 2017 at 02:34:15 +0300, Dmitry Gutov wrote: > On 9/2/17 8:40 PM, Alan Mackenzie wrote: > > I'm not happy about this. 22983 is a serious design flaw, which has had > > deleterious effects deep within Emacs. > I'm sure we want to fix design flaws. As long as there is a solid plan > that does not swap one flaw for another. Plan or not, it should be fixed. > > One recorded example, resulting > > in an infinite loop, is: > > > > ######################################################################### > > From: Philipp Stephani > > To: emacs-devel@gnu.org > > Subject: [PATCH] Protect against an infloop in python-mode > > Date: Tue, 28 Feb 2017 22:31:49 +0100 > > > > There appears to be an edge case caused by using `syntax-ppss' in a > > narrowed buffer during JIT lock inside of Python triple-quote strings. > > Unfortunately it is impossible to reproduce without manually > > destroying the syntactic information in the Python buffer, but it has > > been observed in practice. In that case it can happen that the syntax > > caches get sufficiently out of whack so that there appear to be > > overlapping strings in the buffer. As Python has no nested strings, > > this situation is impossible and leads to an infloop in > > `python-nav-end-of-statement'. Protect against this by checking > > whether the search for the end of the current string makes progress. > > ######################################################################### > > > > In this case, Philipp had to apply a workaround. > The problem manifested during jit-lock. Do we understand why the (widen) > call inside font-lock-default-fontify-region didn't help? I don't, not in detail, no. Philipp might know. But if syntax-ppss was used whilst the buffer was narrowed, it likely corrupted its cache, and that corruption remained after widening the buffer. -- Alan Mackenzie (Nuremberg, Germany).