From unknown Sun Jun 22 00:15:00 2025 X-Loop: help-debbugs@gnu.org Subject: bug#41195: 27.0.91; Using syntax-ppss-flush-cache in syntax-propertize-function infloops Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 May 2020 23:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41195 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 41195@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.158923996527301 (code B ref -1); Mon, 11 May 2020 23:33:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 May 2020 23:32:45 +0000 Received: from localhost ([127.0.0.1]:53627 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYHue-00076H-WD for submit@debbugs.gnu.org; Mon, 11 May 2020 19:32:45 -0400 Received: from lists.gnu.org ([209.51.188.17]:52358) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYHuc-000769-M4 for submit@debbugs.gnu.org; Mon, 11 May 2020 19:32:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYHuc-0001mf-Fu for bug-gnu-emacs@gnu.org; Mon, 11 May 2020 19:32:42 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:52570) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYHub-0000RD-NE for bug-gnu-emacs@gnu.org; Mon, 11 May 2020 19:32:42 -0400 Received: by mail-wm1-x32b.google.com with SMTP id m24so10192443wml.2 for ; Mon, 11 May 2020 16:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:subject:from:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=dUbJSVsBUVdZkD0KJjJshiST3eBdwcVi8hF8Edb2n8s=; b=Qd+hbMV+nDklfsoSg4zMB/YcdPYTD5NlFrzF082IFvES+an1vbBJzWs17HmK621N+K 8+aHW94jJmgZbO2m2/9BTKgqfTzNufxLitMVRjTGoui06dPv1GO89nBCFDT/oaDff9RF +X1d5cfuaGvy8GEeDmrtmGgjDgpn6X6Acgk/+KVSiTZEWiKbSNK/QauHattEI5Kh+ZMJ JaJWGfEgDILahblETU33JPdguB9Jix4lu3jQdK07JqKG52q/a/kl7h4XySlkt0NXSPQs /v2/u3MeUjs/ekcjGh9DvQp9LruJ4hrVVyFLVhw5Ka9/h2MLxYbr3J+Bv3dCKycmQfi2 cTSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:subject:from:message-id:date :user-agent:mime-version:content-language:content-transfer-encoding; bh=dUbJSVsBUVdZkD0KJjJshiST3eBdwcVi8hF8Edb2n8s=; b=C2d7AwBm7ZP0OnliKNS3poSvYqGJPNgqPEJig7qSjYj6aGeLfkpqaENOZnFK0RoYHu Q4KWvQ8zvOzSMjw2bkgi9dfdOJi3fSA8M5xgC5rYnp/FGrM1yNwZ/qPZq2llYPlfZchF ljsH9nMuCGNQws2NlBY1ySmfOfjzSryOiDOdIa5OUlnE5ywbkDl5KQUy0OmfRp0AYtUm GwTCZs2VpPopeMAneXvlQwFl3pwTJQHnzoFsipEpmb0siIvqR6vS5I8hmvDcFT3LRfdk YrhZdsQSEziMEgVqow4IDPab+UrALDnsJd1l/T8BrEJ58MFs+PYnLpFqLoufl8uUIWdV L2NQ== X-Gm-Message-State: AGi0Puax4gbXiemAD/Mki6t71ek4OIBbnRXiHrRNojqI9V9e0n/b/6j+ qJklne648VODPEeTC+M94ExxIH7f X-Google-Smtp-Source: APiQypJXC9VNUnMqVhOi0pFCn3Et0fe/dHT0HNYDdJkkojggw1UVJW+R7vo+91vByUlcgbTzftFFLA== X-Received: by 2002:a1c:f012:: with SMTP id a18mr32950324wmb.41.1589239959366; Mon, 11 May 2020 16:32:39 -0700 (PDT) Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id d9sm4579594wmd.10.2020.05.11.16.32.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 May 2020 16:32:38 -0700 (PDT) From: Dmitry Gutov Message-ID: <1d616b0d-3e1b-5f72-da35-d0aa056322b4@yandex.ru> Date: Tue, 12 May 2020 02:32:37 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=raaahh@gmail.com; helo=mail-wm1-x32b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: In theory, syntax-propertize-function implementations shouldn't change buffer syntax the way that would affect the current syntax-ppss cache. Or if they do, they should clear the cache accordingly. Unfortunately, using syntax-ppss-flush-cache for that purpose doesn't work: it makes Emacs infloop. Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dgutov[at]yandex.ru) -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.51.188.17 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [209.51.188.17 listed in list.dnswl.org] 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 2.0 SPOOFED_FREEMAIL No description available. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.8 (-) In theory, syntax-propertize-function implementations shouldn't change buffer syntax the way that would affect the current syntax-ppss cache. Or if they do, they should clear the cache accordingly. Unfortunately, using syntax-ppss-flush-cache for that purpose doesn't work: it makes Emacs infloop. To reproduce, apply this patch: diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 5ec3e94275..efe38049ab 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -2362,6 +2362,7 @@ js-syntax-propertize (eval-when-compile (append "=({[,:;" '(nil)))))) (put-text-property (match-beginning 1) (match-end 1) 'syntax-table (string-to-syntax "\"/")) + (syntax-ppss-flush-cache (match-beginning 0)) (js-syntax-propertize-regexp end))))) ("\`\(#\)!" (1 "< b")) ("<" (0 (ignore and then edit a file with js-mode containing a = /xyz/ From unknown Sun Jun 22 00:15:00 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Dmitry Gutov Subject: bug#41195: closed (Re: bug#41195: 27.0.91; Using syntax-ppss-flush-cache in syntax-propertize-function infloops) Message-ID: References: <1d616b0d-3e1b-5f72-da35-d0aa056322b4@yandex.ru> X-Gnu-PR-Message: they-closed 41195 X-Gnu-PR-Package: emacs Reply-To: 41195@debbugs.gnu.org Date: Tue, 12 May 2020 20:56:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1589316961-28649-1" This is a multi-part message in MIME format... ------------=_1589316961-28649-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #41195: 27.0.91; Using syntax-ppss-flush-cache in syntax-propertize-functio= n infloops which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 41195@debbugs.gnu.org. --=20 41195: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D41195 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1589316961-28649-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 41195-close) by debbugs.gnu.org; 12 May 2020 20:55:51 +0000 Received: from localhost ([127.0.0.1]:56615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYbw9-0007RP-Eg for submit@debbugs.gnu.org; Tue, 12 May 2020 16:55:51 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:11186) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYbw5-0007R8-TH for 41195-close@debbugs.gnu.org; Tue, 12 May 2020 16:55:36 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 499F9450C47; Tue, 12 May 2020 16:55:28 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 4831B450A40; Tue, 12 May 2020 16:55:22 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1589316922; bh=+8m3vc10Qg0hI015YiXGZ1fjI8Yos5B9045Ad97xzJg=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=PnZFUW/L1MhNeHTO65zWUhB87tYyWyd6KF/qhgpoPXBiqD+QY9NMKpRT0WepRYuzW SOQ2yB9ho/iOn8enSge3vW5srDrhmylK5RX3Lic8RKKJpb62lEcw0SlBcsB7FbOMrr YGV6qG+gZahYBOISMRSmdjR/dNKRckRVgV0HRnswlOaBCqxljBQIfftKUWe/TCi+vw JVrDRayTRHJpVbRwW/CNrLoLzHxmrjh5swaB5Fly++sjAKxCOn9XNs5X/BhyDkgH0r RSGgaoHNO8pApJMtXj82soOfiLmgSLUoWrZuXaCmh37KU6kZ6IHei+tIXcWVofMgw5 BJCMQxIQQAfXg== Received: from alfajor (unknown [216.154.3.202]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BB38A1208FA; Tue, 12 May 2020 16:55:21 -0400 (EDT) From: Stefan Monnier To: Dmitry Gutov Subject: Re: bug#41195: 27.0.91; Using syntax-ppss-flush-cache in syntax-propertize-function infloops Message-ID: References: <1d616b0d-3e1b-5f72-da35-d0aa056322b4@yandex.ru> Date: Tue, 12 May 2020 16:55:18 -0400 In-Reply-To: <1d616b0d-3e1b-5f72-da35-d0aa056322b4@yandex.ru> (Dmitry Gutov's message of "Tue, 12 May 2020 02:32:37 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.085 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41195-close Cc: 41195-close@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Version: 28.1 > In theory, syntax-propertize-function implementations shouldn't change > buffer syntax the way that would affect the current syntax-ppss cache. > Or if they do, they should clear the cache accordingly. > Unfortunately, using syntax-ppss-flush-cache for that purpose doesn't > work: it makes Emacs infloop. I thought at first that the fix should go into `emacs-27`, but then you correctly pointed out that the docstring of `syntax-propertize-function` warned that `syntax-ppss-flush-cache` should not be called, so this bug is really a known and documented limitation. But indeed, it's a limitation that we should lift, so I installed the patch below into `master`. Stefan diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index 3294378754a..46dc8d9ade8 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el @@ -63,9 +63,10 @@ syntax-propertize-function cannot be handled just by the buffer's syntax-table. The specified function may call `syntax-ppss' on any position -before END, but it should not call `syntax-ppss-flush-cache', -which means that it should not call `syntax-ppss' on some -position and later modify the buffer on some earlier position.") +before END, but if it calls `syntax-ppss' on some +position and later modifies the buffer on some earlier position, +then it is its responsability to call `syntax-ppss-flush-cache' to flush +the now obsolete ppss info from the cache.") (defvar syntax-propertize-chunk-size 500) @@ -320,6 +321,11 @@ syntax-propertize-via-font-lock (defvar-local syntax-ppss-table nil "Syntax-table to use during `syntax-ppss', if any.") +(defvar-local syntax-propertize--inhibit-flush nil + "If non-nil, `syntax-ppss-flush-cache' only flushes the ppss cache. +Otherwise it flushes both the ppss cache and the properties +set by `syntax-propertize'") + (defun syntax-propertize (pos) "Ensure that syntax-table properties are set until POS (a buffer point)." (when (< syntax-propertize--done pos) @@ -375,8 +381,13 @@ syntax-propertize ;; (message "syntax-propertizing from %s to %s" start end) (remove-text-properties start end '(syntax-table nil syntax-multiline nil)) - ;; Avoid recursion! - (let ((syntax-propertize--done most-positive-fixnum)) + ;; Make sure we only let-bind it buffer-locally. + (make-local-variable 'syntax-propertize--inhibit-flush) + ;; Let-bind `syntax-propertize--done' to avoid infinite recursion! + (let ((syntax-propertize--done most-positive-fixnum) + ;; Let `syntax-propertize-function' call + ;; `syntax-ppss-flush-cache' without worries. + (syntax-propertize--inhibit-flush t)) (funcall syntax-propertize-function start end))))))))) ;;; Link syntax-propertize with syntax.c. @@ -455,7 +466,8 @@ 'syntax-ppss-after-change-function (defun syntax-ppss-flush-cache (beg &rest ignored) "Flush the cache of `syntax-ppss' starting at position BEG." ;; Set syntax-propertize to refontify anything past beg. - (setq syntax-propertize--done (min beg syntax-propertize--done)) + (unless syntax-propertize--inhibit-flush + (setq syntax-propertize--done (min beg syntax-propertize--done))) ;; Flush invalid cache entries. (dolist (cell (list syntax-ppss-wide syntax-ppss-narrow)) (pcase cell ------------=_1589316961-28649-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 11 May 2020 23:32:45 +0000 Received: from localhost ([127.0.0.1]:53627 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYHue-00076H-WD for submit@debbugs.gnu.org; Mon, 11 May 2020 19:32:45 -0400 Received: from lists.gnu.org ([209.51.188.17]:52358) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYHuc-000769-M4 for submit@debbugs.gnu.org; Mon, 11 May 2020 19:32:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYHuc-0001mf-Fu for bug-gnu-emacs@gnu.org; Mon, 11 May 2020 19:32:42 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:52570) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYHub-0000RD-NE for bug-gnu-emacs@gnu.org; Mon, 11 May 2020 19:32:42 -0400 Received: by mail-wm1-x32b.google.com with SMTP id m24so10192443wml.2 for ; Mon, 11 May 2020 16:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:subject:from:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=dUbJSVsBUVdZkD0KJjJshiST3eBdwcVi8hF8Edb2n8s=; b=Qd+hbMV+nDklfsoSg4zMB/YcdPYTD5NlFrzF082IFvES+an1vbBJzWs17HmK621N+K 8+aHW94jJmgZbO2m2/9BTKgqfTzNufxLitMVRjTGoui06dPv1GO89nBCFDT/oaDff9RF +X1d5cfuaGvy8GEeDmrtmGgjDgpn6X6Acgk/+KVSiTZEWiKbSNK/QauHattEI5Kh+ZMJ JaJWGfEgDILahblETU33JPdguB9Jix4lu3jQdK07JqKG52q/a/kl7h4XySlkt0NXSPQs /v2/u3MeUjs/ekcjGh9DvQp9LruJ4hrVVyFLVhw5Ka9/h2MLxYbr3J+Bv3dCKycmQfi2 cTSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:subject:from:message-id:date :user-agent:mime-version:content-language:content-transfer-encoding; bh=dUbJSVsBUVdZkD0KJjJshiST3eBdwcVi8hF8Edb2n8s=; b=C2d7AwBm7ZP0OnliKNS3poSvYqGJPNgqPEJig7qSjYj6aGeLfkpqaENOZnFK0RoYHu Q4KWvQ8zvOzSMjw2bkgi9dfdOJi3fSA8M5xgC5rYnp/FGrM1yNwZ/qPZq2llYPlfZchF ljsH9nMuCGNQws2NlBY1ySmfOfjzSryOiDOdIa5OUlnE5ywbkDl5KQUy0OmfRp0AYtUm GwTCZs2VpPopeMAneXvlQwFl3pwTJQHnzoFsipEpmb0siIvqR6vS5I8hmvDcFT3LRfdk YrhZdsQSEziMEgVqow4IDPab+UrALDnsJd1l/T8BrEJ58MFs+PYnLpFqLoufl8uUIWdV L2NQ== X-Gm-Message-State: AGi0Puax4gbXiemAD/Mki6t71ek4OIBbnRXiHrRNojqI9V9e0n/b/6j+ qJklne648VODPEeTC+M94ExxIH7f X-Google-Smtp-Source: APiQypJXC9VNUnMqVhOi0pFCn3Et0fe/dHT0HNYDdJkkojggw1UVJW+R7vo+91vByUlcgbTzftFFLA== X-Received: by 2002:a1c:f012:: with SMTP id a18mr32950324wmb.41.1589239959366; Mon, 11 May 2020 16:32:39 -0700 (PDT) Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id d9sm4579594wmd.10.2020.05.11.16.32.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 May 2020 16:32:38 -0700 (PDT) To: bug-gnu-emacs@gnu.org Subject: 27.0.91; Using syntax-ppss-flush-cache in syntax-propertize-function infloops From: Dmitry Gutov Message-ID: <1d616b0d-3e1b-5f72-da35-d0aa056322b4@yandex.ru> Date: Tue, 12 May 2020 02:32:37 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=raaahh@gmail.com; helo=mail-wm1-x32b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: In theory, syntax-propertize-function implementations shouldn't change buffer syntax the way that would affect the current syntax-ppss cache. Or if they do, they should clear the cache accordingly. Unfortunately, using syntax-ppss-flush-cache for that purpose doesn't work: it makes Emacs infloop. Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dgutov[at]yandex.ru) -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.51.188.17 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [209.51.188.17 listed in list.dnswl.org] 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 2.0 SPOOFED_FREEMAIL No description available. X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.8 (-) In theory, syntax-propertize-function implementations shouldn't change buffer syntax the way that would affect the current syntax-ppss cache. Or if they do, they should clear the cache accordingly. Unfortunately, using syntax-ppss-flush-cache for that purpose doesn't work: it makes Emacs infloop. To reproduce, apply this patch: diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 5ec3e94275..efe38049ab 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -2362,6 +2362,7 @@ js-syntax-propertize (eval-when-compile (append "=({[,:;" '(nil)))))) (put-text-property (match-beginning 1) (match-end 1) 'syntax-table (string-to-syntax "\"/")) + (syntax-ppss-flush-cache (match-beginning 0)) (js-syntax-propertize-regexp end))))) ("\`\(#\)!" (1 "< b")) ("<" (0 (ignore and then edit a file with js-mode containing a = /xyz/ ------------=_1589316961-28649-1-- From unknown Sun Jun 22 00:15:00 2025 X-Loop: help-debbugs@gnu.org Subject: bug#41195: 27.0.91; Using syntax-ppss-flush-cache in syntax-propertize-function infloops Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 May 2020 21:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41195 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 41195-close@debbugs.gnu.org Received: via spool by 41195-done@debbugs.gnu.org id=D41195.158931751429789 (code D ref 41195); Tue, 12 May 2020 21:06:02 +0000 Received: (at 41195-close) by debbugs.gnu.org; 12 May 2020 21:05:14 +0000 Received: from localhost ([127.0.0.1]:56644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYc5S-0007kO-6N for submit@debbugs.gnu.org; Tue, 12 May 2020 17:05:14 -0400 Received: from mail-wm1-f52.google.com ([209.85.128.52]:38418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYc5R-0007kB-0f for 41195-close@debbugs.gnu.org; Tue, 12 May 2020 17:05:13 -0400 Received: by mail-wm1-f52.google.com with SMTP id g12so25480928wmh.3 for <41195-close@debbugs.gnu.org>; Tue, 12 May 2020 14:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6o8iWLEKKIxmFGTiF10nw44v01oavsqcvYQGBYaS+Ns=; b=YR6NOnY5abAHGIUhEuAOZcpQEx8q+UlelypkK5FQPbY9tWiA0QX52DJymoSKAbUPa+ qsJmOC9af4wRmpooHP0vR1gqnefi8vta0lHK1xvI6RBXus147ylP8vmhEt/FUT7zQWDY MRy1A4WKJp+BwXDvd18NW7GUJ0uvF+k8dHEn8dQUiTVmL/I+kcIFqpojV6G6atmew6E7 IkxMb0N1QnEo8Tlwomr8jauUydFUmnMC0uQ2E7yPazzeYYm9s8OqgWlrqM1PHwKW34V5 IVfyy5tzQebN+Vyi80ZQMKZqma/LcyUzggtKnXCe1THNdQby6tkTZkLL6A6xbKjJ1J5Y LYHA== 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:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6o8iWLEKKIxmFGTiF10nw44v01oavsqcvYQGBYaS+Ns=; b=pyRMRl4iomzC+NjMKPK0gnhBmrAYnTjzKuVQEIqQE2UGJNrjFly8Obt46ZRwN6kTW3 t4LE4HvN5MhhqMGIl0jWp558tcKoNT8sv7hrD8LvggOhcn/1oE//e2oGn/LVvR67VAYq 4+Y9njDJVtTorXxvRuMe9upw4wb6gMDDl3Qpq44CwRP/h6IPSz7T5roEJN+ioo5R63xw 8TOUFEzziu5p2oFuBS4xuopBWwoR2RipN8DMNe4li4Ysyq6v0CZmTmE1QGNv/r4/9yCC VCP24Xpy8EifF/h6C/JrX+NpxZpJ2sNQv6nxLH4/5xkqjxx/kfjVmGVKYH9baQNn92Kr Jp3g== X-Gm-Message-State: AGi0Puat/DDkcvJSf+sbukCzWbBHRl7uhKfbBVAS8p79M1PrBL4ncT5b moK3r/1LjcmjRFy+CZxP5MT9Hsas X-Google-Smtp-Source: APiQypI3pxARCQadUFO/nozSw8vzXs1Cj+pEt1/hFXiKMjd6SrK23JgdVV61TKizi+sbcNUfnuHNmg== X-Received: by 2002:a1c:7d92:: with SMTP id y140mr23944315wmc.10.1589317506710; Tue, 12 May 2020 14:05:06 -0700 (PDT) Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id 2sm24479673wre.25.2020.05.12.14.05.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 May 2020 14:05:06 -0700 (PDT) References: <1d616b0d-3e1b-5f72-da35-d0aa056322b4@yandex.ru> From: Dmitry Gutov Message-ID: <9634471f-0921-7f8b-c058-816b7bccb5a1@yandex.ru> Date: Wed, 13 May 2020 00:05:04 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 12.05.2020 23:55, Stefan Monnier wrote: > I thought at first that the fix should go into `emacs-27`, but then you > correctly pointed out that the docstring of `syntax-propertize-function` > warned that `syntax-ppss-flush-cache` should not be called, so this bug > is really a known and documented limitation. > > But indeed, it's a limitation that we should lift, so I installed the > patch below into `master`. OK. Thank you.