From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer Date: Sat, 23 Dec 2023 00:08:51 -0800 Message-ID: <1DE32BF7-75D8-4F49-975D-53C782D26016@gmail.com> References: <87r0jdddxf.fsf@yandex.ru> <835y0pfkgr.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7952"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Denis Zubarev , 67977@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 23 09:10:13 2023 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 1rGx5I-0001oy-Su for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Dec 2023 09:10:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGx56-0003BC-BN; Sat, 23 Dec 2023 03:10:00 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rGx54-0003Ay-Jh for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2023 03:09:58 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGx53-0003mK-Ap for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2023 03:09:58 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rGx58-0001i8-CX for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2023 03:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Dec 2023 08:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67977 X-GNU-PR-Package: emacs Original-Received: via spool by 67977-submit@debbugs.gnu.org id=B67977.17033189576521 (code B ref 67977); Sat, 23 Dec 2023 08:10:02 +0000 Original-Received: (at 67977) by debbugs.gnu.org; 23 Dec 2023 08:09:17 +0000 Original-Received: from localhost ([127.0.0.1]:48461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGx4O-0001h7-QL for submit@debbugs.gnu.org; Sat, 23 Dec 2023 03:09:17 -0500 Original-Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:49661) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGx4L-0001gs-Rk for 67977@debbugs.gnu.org; Sat, 23 Dec 2023 03:09:15 -0500 Original-Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1d3e8a51e6bso20145735ad.3 for <67977@debbugs.gnu.org>; Sat, 23 Dec 2023 00:09:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703318943; x=1703923743; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=OCTPI0QuznXuyMF7W/VHzGrX+xnOwpL6vrcOInVV3iY=; b=Zb1LZuyV7kkt5/U/ly3auYaBae6P3td1YA4NFjWOIeSxXMazXPZl4kD9PahOOqRFFB G8dNudt2mEdkyZ5i/X17H7K68qELL5vfyT/MolBN/oR1iaya3ny18LRc2I5On7wJoUlS MVxvuJRh0O4YMOKndcqCu4KKIu9JmLVv4z3JKLgS+kZHIJWejw18B6em6lwI6Bw1WOFt 6rEpMj4vU78jpSn6jeer5Y+xNGXK41UX33biAOqoZwMKXpHqayibuNeVoymT7makICvz gZ7os4sltdZNfTCcedO3C/2OFgife4MiAGvdkC0o7eVWj+RGA599sLfsd1/Ym436dL9J aWlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703318943; x=1703923743; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OCTPI0QuznXuyMF7W/VHzGrX+xnOwpL6vrcOInVV3iY=; b=gJyeJskHagyuPaotFP4Jg5PqT73xoNh1W39RqE3nO9IqLR2mbxtNCu6GdvtQLu+Gfb ybRclDK7PFAS1SNHIAUaVRyxaTV4/mPrVveVIsrMoe2E5C0Q4YGikhxNx55IvuvqIwQV e25y5wR0Knb9BzYnwD0NDipLO+kVRNY43r+o2qUYIQXJWkrPGafgEFSabDxhvw/gSJ/Q vFBXrqpFPPEYlFz3QRx3tN8QOoajaHWpQrCdSO0zHjQu6GhA49PZHgRy15xgpOlUU0R3 Y+ZN0nJY2wPqixv4USXA4ndfSWlAJHe0M5+ueE6ZxXKm4+PCS8TCZc+FURP/lyJxtP2M t3kw== X-Gm-Message-State: AOJu0Yxyql/2yJvcS+8Vt8bWK4Nr4B2upIGParl6CTOsv1hIqjxnyeNj x8gKODa8I6p3fEHpX850e0A= X-Google-Smtp-Source: AGHT+IFgzgK9nQpDKheHRCTT2jc7JKWgu7JrVl9XeIMnmrEf/Z/+h4X5id2e5HefTST7F5xCki9Tkw== X-Received: by 2002:a17:903:2349:b0:1cf:f7c3:1e32 with SMTP id c9-20020a170903234900b001cff7c31e32mr2645235plh.27.1703318942644; Sat, 23 Dec 2023 00:09:02 -0800 (PST) Original-Received: from smtpclient.apple (172-117-161-177.res.spectrum.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id g24-20020a1709029f9800b001d0696e9237sm4557746plq.118.2023.12.23.00.09.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Dec 2023 00:09:02 -0800 (PST) In-Reply-To: <835y0pfkgr.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.700.6) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:276707 Archived-At: > On Dec 22, 2023, at 11:26 PM, Eli Zaretskii wrote: >=20 >> From: Denis Zubarev >> Date: Sat, 23 Dec 2023 02:18:20 +0300 >>=20 >> 1. emacs -Q >> 2. M-x find-file /tmp/t.py >> 3. paste there >> start=3D1 >> def _init(self, param1, param2, param3=3DFalse): >> self._param1 =3D param2 >> self._param2 =3D param2 >> self._param3 =3D param3 >> 4. python-ts-mode >> 5. select two last lines and M-x narrow-to-region >> 6. answer all prompts >> 7. Put cursor on the last self >> 8. M-x eval-expression >> (progn >> (setq temp-node (treesit-node-at (point))) >> (sit-for 2) >> (garbage-collect) >> (message "node %s" temp-node)) >> 9. Emacs crashes or prints node that contains garbage >=20 > Thanks. >=20 > Yuan, this also happens on the emacs-29 branch, so we should try > fixing this crash ASAP. Yeah. The node wants to print it=E2=80=99s type name (with = ts_node_type), which access it=E2=80=99s parse tree, but the tree is = already freed, that means the node is outdated and shouldn=E2=80=99t try = to print it=E2=80=99s type name, but should rather print =E2=80=9Coutdated= =E2=80=9D. But simply narrowing the buffer shouldn=E2=80=99t reparse the buffer and = cause the parse tree to be freed. Anyway, let me see what=E2=80=99s = going on. Yuan