From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tom Gillespie Newsgroups: gmane.emacs.bugs Subject: bug#56271: lisp/progmodes/python.el; unmatched quotes cause infinite loop freezing emacs Date: Mon, 27 Jun 2022 18:51:21 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28153"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , 54996@debbugs.gnu.org To: 56271@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 28 03:52:12 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o60Oi-00076U-Uf for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 28 Jun 2022 03:52:12 +0200 Original-Received: from localhost ([::1]:50296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o60Oh-0005gt-Gg for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Jun 2022 21:52:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o60OY-0005gi-Cr for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 21:52:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59757) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o60OY-0008Qv-4E for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 21:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o60OY-0000tr-2K for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 21:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tom Gillespie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Jun 2022 01:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56271 X-GNU-PR-Package: emacs X-Debbugs-Original-To: Emacs Bug Report Original-Received: via spool by submit@debbugs.gnu.org id=B.16563811133442 (code B ref -1); Tue, 28 Jun 2022 01:52:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Jun 2022 01:51:53 +0000 Original-Received: from localhost ([127.0.0.1]:53654 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o60OP-0000tS-8t for submit@debbugs.gnu.org; Mon, 27 Jun 2022 21:51:53 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:57786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o60OL-0000tJ-BI for submit@debbugs.gnu.org; Mon, 27 Jun 2022 21:51:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o60OL-0005c5-3G for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 21:51:49 -0400 Original-Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]:42584) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o60O6-0008PF-RW for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 21:51:48 -0400 Original-Received: by mail-io1-xd33.google.com with SMTP id a10so11472055ioe.9 for ; Mon, 27 Jun 2022 18:51:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to:cc; bh=C6droOTt7DJ4ewmoa3KiuraRe9lEwswkIVOCwxHFjLE=; b=X8yyQvqhrgcRZNTx+38LKQg4fYvtWGOGqaqEWIRbnexFUNEn24AZew/Wd/bZHAi3pz GB0k3q2ATtu5O2ulukfy72T+2VxrLisQgU9TpcGMsV1SPHJsCZvu84Tl92D3Sd/oq3n4 NebyfeygB+56N9RRGQrMLtby7I3RbXQi6DQ3t9tUT+Ag6nHxJ5KSMEg5qfiqkoJxD2kB srr+MLMs7TykifTRLtCR+sQCa/AqqIfbLDCS7q0TeywkLCcd0WHh1O2G4Ft7GidKvMSt xwuE6rCk1FiDfAIuvVhYxggvoFGTgvIyvFGLgrY85hvdNZZGCos1bUPtJMbF07A9YjEx JrRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=C6droOTt7DJ4ewmoa3KiuraRe9lEwswkIVOCwxHFjLE=; b=6tnFXuYnqqwQ8eHgub5X5uenz4Qq086ifzZGv8gZkXjruPDrhkph/ycNXF9ncqHra9 FO/sSQ0nWiAkl9daIZF94VSZGdvgHly7CZjKYsfXgl9zjDeCgUGQ9ZRs/3EXeDRG7aV1 fD9bcn9tkZ6VQzSYoQB97BQegdd9TorfbvGqPnPowhCdS8meJ2Wbx4n6YHgqh0p7Lvul mjpY0HvRoUbSlSWC76vpxBJrH7AAgntNfvjT1e0OHAAB3qkAA6YMtDaOKAlNfEhocbOI JlJsxfZGhaFUKlRm0adG6YhLphQ43aG5FiEnLw3fb4uVoaFeqnbM5kIV9s9gV1OJGW/U eD1g== X-Gm-Message-State: AJIora/ZU+2vqmTTIEcC7KxtzyL8+8HXRTm8foaCfpqXw/2hS8TjNBZs BT67ZBdvAhGMGTmXqAmY/sUp8shOGOM+O1hfW3xmMWS81s4= X-Google-Smtp-Source: AGRyM1tGzGpAV6SDytmsjeU4oorcMKTi9gR344nccoqzkAWkZIxld2N3w1L7UaCLfZpc8RmYlq+wFtn61lUITzOXW+c= X-Received: by 2002:a5d:914b:0:b0:672:6629:bfa2 with SMTP id y11-20020a5d914b000000b006726629bfa2mr8230520ioq.159.1656381093188; Mon, 27 Jun 2022 18:51:33 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::d33; envelope-from=tgbugs@gmail.com; helo=mail-io1-xd33.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, WEIRD_QUOTING=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:235507 Archived-At: Using git bisect shows 85db21b94b23b4701930892d1eecc9a1167ed968 is the source of this issue, all commits following it on master show the same issue. Reverting that commit fixes the issue. While editing python files if a single quote occurs in the file during the course of editing then emacs will enter an infinite loop. The exact location of the single quote is important, but the pattern that triggers it happens frequently in python files. You can get a traceback pinpointing the issue by sending SIGUSR2 to the hung emacs process. Below is a minimal python file that will trigger the issue. Run with emacs -Q evil-python-file.py #+begin_verbatim def ='' ' """""" # there must be at least one space on this line, comment not needed '' #+end_verbatim The full pattern that causes the issue is something like the following. #+begin_verbatim ='' ' #+end_verbatim Any keyword should work I have tested with class, def, and with. The zero or more lines at any indentation can also have single quote marks that are paired, but there is some weirdness when you have 4 on a line that makes it possible to avoid the issue. I can fix the issue by reverting to the cl-assert pattern using unless to raise an error (unless (>= string-start last-string-end) (error "oops")) and running the code after that unconditionally. This prevents jit-lock from trying to run infinitely on a malformed buffer. That said, this may simply reintroduce bug#54996, and the change unmasked some other issue with what is going on during the call to jit-lock-function which needed that error to be throw by cl-assert to avoid infinite loops/retries.