From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#31290: Fundamental bugs in syntax-propertize Date: Tue, 8 May 2018 15:35:14 +0300 Message-ID: References: <20180427210859.GA6023@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1525782854 14654 195.159.176.226 (8 May 2018 12:34:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 8 May 2018 12:34:14 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 To: Alan Mackenzie , 31290@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 08 14:34:10 2018 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 1fG1on-0003i1-FI for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 May 2018 14:34:09 +0200 Original-Received: from localhost ([::1]:50984 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG1qu-0002Ur-Fe for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 May 2018 08:36:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG1qh-0002TT-VT for bug-gnu-emacs@gnu.org; Tue, 08 May 2018 08:36:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fG1qc-000471-T7 for bug-gnu-emacs@gnu.org; Tue, 08 May 2018 08:36:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45644) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fG1qc-00046q-Os for bug-gnu-emacs@gnu.org; Tue, 08 May 2018 08:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fG1qc-0003oy-Bn for bug-gnu-emacs@gnu.org; Tue, 08 May 2018 08:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 May 2018 12:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31290 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31290-submit@debbugs.gnu.org id=B31290.152578292814648 (code B ref 31290); Tue, 08 May 2018 12:36:02 +0000 Original-Received: (at 31290) by debbugs.gnu.org; 8 May 2018 12:35:28 +0000 Original-Received: from localhost ([127.0.0.1]:53540 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fG1q3-0003oC-Sb for submit@debbugs.gnu.org; Tue, 08 May 2018 08:35:28 -0400 Original-Received: from mail-wr0-f173.google.com ([209.85.128.173]:46771) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fG1pz-0003nw-F7 for 31290@debbugs.gnu.org; Tue, 08 May 2018 08:35:24 -0400 Original-Received: by mail-wr0-f173.google.com with SMTP id a12-v6so1246492wrn.13 for <31290@debbugs.gnu.org>; Tue, 08 May 2018 05:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=VYOIVEaIRrc4TFp82f2wDek7DlL8StKt4BkR4d74PTQ=; b=mBuczawT4iEmzk3SgRZNvOGXdAukcQaHOUxrT24lNbUlt96YjdhPsy4t+BrbrskPuN kF9nzgM8Kaz4yYP4CUy+KxcSVe3D9yQJu1mAFH4j0ruUsdMZdM/us/jYG1iLMQVUn4So /FBgaUuYwblAP8X+ATTnXJcFDbk+ihJQGfPVkJ+E+MNF5mDaxJu1t4HpMHaLKjsRpvgn mEN9gVjBKS8Qe2WfhRbcPnbdNLBpTR01xA/2g4Te8xwkzdrG8M8Hiigo5E3iSn7y39g/ wuh46xbIUrLCQ0+WQ9fzHFZmSiAb9a6URJLR6M353/E8lWjbvffv9blE9FMc/VpxPrFY ZacQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=VYOIVEaIRrc4TFp82f2wDek7DlL8StKt4BkR4d74PTQ=; b=gJ8TsstQ9bA+oNJfNyIzn5rgvoyMIFqPyQt22x3NqfaGYd4ZrcWki6L6xUaVe4V556 6w3o+yYSidudHgSiz5HBHYj56HYJaf6+5dMWsuep3tL2JmJ5pkFF3FJDfECfV434OAGM 7TLDAI/wwkVnCQPXINIAN6YM4gIBwq5f8zy6BF57zcQG0pc8VkBD6nxfoknl1T0Ccz0F mIkb0t6CpD5xlG4oEcTw8LIPD3X7WimbAUteNZWNqpugeovX7uhPtRxxgVT6inKbpi1R eqqfuqBJwFW9IX8pyoXxc2piJyZThNDlGkNVkrTXEmJ+RlN80S93FvVyvQtuEx/YbKBz bFMA== X-Gm-Message-State: ALQs6tDxS8uqYvu8Zf69wHQUVyTu3Q9jLIHJUNb+ADf7ERHoPVW2nYQD hmXAIF8xwWudh/0gLIpfXhNR7RDz X-Google-Smtp-Source: AB8JxZoHbA1vlFJmZXO2KGHVnMZM2QfPcNZW5FPh2e/EflgVZ3VLKZE1Bf3mKTRf2Uo+y9fPzW247w== X-Received: by 2002:adf:b78b:: with SMTP id s11-v6mr26222145wre.247.1525782917366; Tue, 08 May 2018 05:35:17 -0700 (PDT) Original-Received: from [192.168.0.200] ([212.50.99.193]) by smtp.googlemail.com with ESMTPSA id h133sm11716321wmf.47.2018.05.08.05.35.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 05:35:16 -0700 (PDT) In-Reply-To: <20180427210859.GA6023@ACM> Content-Language: en-US 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:146074 Archived-At: On 4/28/18 12:08 AM, Alan Mackenzie wrote: > At least that would be true if syntax-propertize--done hadn't been > prematurely and spuriously increased, crudely to prevent an infinite > recursion, falsely indicating to the syntax-ppss infrastructure that the > syntax-table properties have already been applied to the region (BEGIN > END). > > .... but it should not call `syntax-ppss-flush-cache', .... > > Why not? Because syntax-ppss-flush-cache sets syntax-propertize--done > back to its true value, allowing the wrongly allowed syntax-ppss calls at > a later position to cause a recursive loop. Maybe we should "allow" it to loop, in certain cases? Leaving it to be the responsibility of the programmer, to make sure the result doesn't infloop, even if these rules are violated. > .... which means that it should not call `syntax-ppss' on some > position and later modify the buffer on some earlier position. > > This is a bad restriction, because sometimes syntax-table properties can > only be correctly determined by examining the syntax of later buffer > positions. An example of this is giving the string-fence syntax-table > text property to an unbalanced opening string quote, but not to correctly > matched quotes. I'm not exactly convinced by the given example (why would we use the string-fence in that case?), but it might be better if something like this was possible, indeed. > 2. syntax-propertize-function's are banned from using syntax-ppss, the > documentation instead directing them to use parse-partial-sexp directly. The ones that currently call syntax-ppss, can't simply switch over to parse-partial-sexp without becoming slower due to the lack of cache. Before tackling this bug, I'd rather we see a real-world problem that it caused, and pick a particular approach based on it. But off the top of my head, we could introduce a "stricter but somewhat slower" variation of syntax-ppss to be called inside syntax-propertize-function's, which would treat the values in question more carefully, somehow.