GNU bug report logs - #71681
29.3.50; tree-sitter crash

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Juri Linkov <juri@HIDDEN>; dated Thu, 20 Jun 2024 16:43:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 71681 <at> debbugs.gnu.org:


Received: (at 71681) by debbugs.gnu.org; 1 Mar 2025 02:00:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 28 21:00:50 2025
Received: from localhost ([127.0.0.1]:55848 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1toC9p-0000GS-T7
	for submit <at> debbugs.gnu.org; Fri, 28 Feb 2025 21:00:50 -0500
Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]:45514)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1toC9m-0008LP-Qu
 for 71681 <at> debbugs.gnu.org; Fri, 28 Feb 2025 21:00:47 -0500
Received: by mail-ed1-x534.google.com with SMTP id
 4fb4d7f45d1cf-5dee07e51aaso4868622a12.3
 for <71681 <at> debbugs.gnu.org>; Fri, 28 Feb 2025 18:00:46 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740794440; x=1741399240; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=bYn4fFo+9LSA9PMjBDUo42ybAsWIUkNT/AEoNIDOOOI=;
 b=Dg5WUuiN7EHDaH5lN1DwSxQGOKKFgEefUfthTSdH6mt/MBmzUi/hPqxoQNjuUNFINQ
 0sAyqDw2no8nbVb4iOD+ZWyRQO08K4IiJTMLr0KULfLJw1oIUvvWVlj92STeyMD120xv
 jAKNFOEekGbgVedcsvXVuOj0idnllKCxCgi706r0DM2kZ5Bis5kAT8SD2iaHafZmCHKc
 Qs5n8sb3ojI/3Mmw+8T2yWrHiNS6+dSDLv0w+608AQi0k75IoWO6MELj7rbUauLZcY0S
 Zivxmei/ZflXm5iDSqBPVm6/Py2TQEQi6iJXb0cA9HVM1nbCm/EMnaFUARBWEEhayYVz
 6Xpg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740794440; x=1741399240;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=bYn4fFo+9LSA9PMjBDUo42ybAsWIUkNT/AEoNIDOOOI=;
 b=tNwyjrYzvjA4ALTvA4Wnp3S0BUsumq6z2GqtpAGeuTqqcGmspIfPZZc7qjtPL2NbEz
 KEnq1VNp7f2S+XSjg+c/MVjWpKyCK3kQxEOs5VjFI7MEsdg+/PMG0i3KrYKNUBjT3kF9
 Kgv4ciyZnnTvjrMcuxn68am6YcYRPhTwUKMGo7gLThOaixDN7VVbCyXro+cYrf/aygJV
 H6s30dhiHP2Zl/Gq0LVRhsnBZtm8z79KaraJFqU4N7qQVN0oEnhrHb/etlyw3hpxj3rp
 imroM+kUWtVweThJb4V4Z+Jk7Nh2DEiwtIcGdijwWs2cal+Su/7Ksq+QhRpOYRZNe+BS
 ZUTQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCU3xFTi/wo7RrM73hpivYkNmL4kGNAnVJ5YW0kfAxTM4BXnEBydyRHEjNw36YK/Rtxej37J4g==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Yx4TAVpkwq/ZDuiWmjpbrMr0Ji+qR8VUw/lqMGxC+yHtBWrCifA
 fuixwIIyXQg9aGlmTdi6giR8QJLrpLUTjX2h+cbyDF6jE6JgzNXri/ou8Ar9Iv0zdvde9LpP+Ar
 g9zGlb+Czr7bTzAxsHFhtLCPGTWw=
X-Gm-Gg: ASbGncvDhItTg0OxvAdT02n8w1XVIjMWtCGG4mFNoqR8Fqy5+DHkJk3sifLqB2+GYLU
 maMHlcYPUbHRjBqN0A1W1gXjsE2qUICeLBzwVGyOPkcSajxOdZN6VLeWs8VBWpdZQZxkC4L+Cjb
 GvX6OHGNKPVlys81C/dmDBotzckJY=
X-Google-Smtp-Source: AGHT+IG6Oour6SO/LGxDC2ei0cj4fVUuUH8IGB9tFiKYEH1Pv1ewjZLkuJxK2cehl2OUDiqb0KibZURPtlCYg+LE4Ys=
X-Received: by 2002:a05:6402:51d2:b0:5e4:d11e:7c4c with SMTP id
 4fb4d7f45d1cf-5e4d6b878e2mr4712677a12.28.1740794440321; Fri, 28 Feb 2025
 18:00:40 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Fri, 28 Feb 2025 18:00:40 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <C5CEE51F-EDFA-4CF2-9D22-3E1242EEC0B8@HIDDEN>
References: <86h6dny3om.fsf@HIDDEN>
 <9D0E4C93-9CCC-4C0E-BDF7-CB6F09132C23@HIDDEN>
 <86o77rpnjz.fsf@HIDDEN>
 <74F62063-1C20-4257-92BA-F2CF02B9A588@HIDDEN>
 <E28313FF-A353-4BB5-BC06-FFD4E5F19385@HIDDEN>
 <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN>
 <864j99d2vr.fsf@HIDDEN>
 <C5CEE51F-EDFA-4CF2-9D22-3E1242EEC0B8@HIDDEN>
MIME-Version: 1.0
Date: Fri, 28 Feb 2025 18:00:39 -0800
X-Gm-Features: AQ5f1Jp_L6_JeWvn4GGvMz_TLwlVi1LpYCNJ-IRmUiOGUo28T1NHW2MnXzd18a8
Message-ID: <CADwFkmnAMn7+um6BEaVpZCUrerxn4uwY2epgYrWTOa=2aUpXWg@HIDDEN>
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
To: Yuan Fu <casouri@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 71681
Cc: 71681 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

Yuan Fu <casouri@HIDDEN> writes:

>> On Jun 30, 2024, at 11:49=E2=80=AFPM, Juri Linkov <juri@HIDDEN> wrot=
e:
>>
>>> I reduced the crash to a signal and pushed the fix to emacs-30.
>>> Next I=E2=80=99ll make sure the signal is properly handled.
>>
>> Now with the latest emacs-30 at the commit b2c966f8396
>> there is another problem:
>>
>> 0. emacs -Q
>> 1. eval: (setq backtrace-on-redisplay-error t)
>> 2. eval: (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
>> 3. C-x v L
>> 4. in the *vc-change-log* buffer move point to the commit b2c966f8396
>> 5. type D
>>
>> Warning (error): Error in a redisplay Lisp hook.
>> See buffer *Redisplay-trace*
>>
>> Error: treesit-node-outdated (#<treesit-node-outdated>)
>>  treesit--font-lock-fontify-region-1(#<treesit-node-outdated> #<treesit-=
compiled-query> 99654 99975 nil nil)
>>  treesit-font-lock-fontify-region(99654 99975 nil)
>>  font-lock-fontify-syntactically-region(99654 99975 nil)
>>  font-lock-default-fontify-region(99654 99974 nil)
>>  font-lock-fontify-region(99654 99974)
>>  font-lock-ensure(99654 99974)
>>  diff-syntax-fontify-hunk(122 539 t)
>>  diff-syntax-fontify(122 539)
>>  diff--font-lock-syntax(539)
>>  font-lock-fontify-keywords-region(1 539 nil)
>>  font-lock-default-fontify-region(1 539 nil)
>>  font-lock-fontify-region(1 539)
>>  jit-lock--run-functions(1 539)
>>  jit-lock-fontify-now(1 539)
>>  jit-lock-function(1)
>>  vc-diff-finish(#<buffer *vc-diff*> nil nil)
>>  vc-exec-after(#f(compiled-function () #<bytecode -0xcd6e6e57937525e>))
>>  log-view-diff-common(1 1 t)
>>  log-view-diff-changeset(1 1)
>>  funcall-interactively(log-view-diff-changeset 1 1)
>>  command-execute(log-view-diff-changeset)
>
> Yes, that=E2=80=99s what meant by =E2=80=9Creduced crash to signal=E2=80=
=9D. The crash is fixed, but I
> need to fix the font-lock code so it can handle the signal gracefully (or=
 don=E2=80=99t
> cause the signal from the first place). It=E2=80=99s not yet clear to me =
why does
> treesit-font-lock-fontify-region end up using an outdated node for query.

Did you make any progress with the second part of this fix?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at 71681 <at> debbugs.gnu.org:


Received: (at 71681) by debbugs.gnu.org; 1 Jul 2024 10:22:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 01 06:22:01 2024
Received: from localhost ([127.0.0.1]:60195 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sOEAa-0004D7-Ng
	for submit <at> debbugs.gnu.org; Mon, 01 Jul 2024 06:22:00 -0400
Received: from mail-ej1-f44.google.com ([209.85.218.44]:44167)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <v.pupillo@HIDDEN>) id 1sOEAZ-0004Cq-HS
 for 71681 <at> debbugs.gnu.org; Mon, 01 Jul 2024 06:22:00 -0400
Received: by mail-ej1-f44.google.com with SMTP id
 a640c23a62f3a-a72517e6225so311665266b.0
 for <71681 <at> debbugs.gnu.org>; Mon, 01 Jul 2024 03:21:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719829253; x=1720434053; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=DxxOz3Ix5iZMRpuo5zvbkarI2Z3ye1tCtWQl2oykLNY=;
 b=JB13Np2L+87zVqPFqImwwTgi+aPvljqjYcCXPFbk7nKy0XP7ZQDKLOzSwuTY5d+r3S
 Y9CVUVt7ceU6brsTY/N2Msp8HO9pi1WqtZucGppAJkk47Ke+lYdAI6bLoW/8EYERNMex
 37a9b/VJ1f+sg1bnvYMwj5kcH26WCUDtmzs5V82mTZLviJlQRhbbzLwGvIYHixkhtVQI
 x3FxFNmOj4e/fKcSRPwdVvL/ZcivngMqBXOvHll1xxaQ7kMHebkg8PP/9MVw5ClmYX3A
 QQzWQ21sZjylC7f42+uebBvyXeAjadMhTt3QtPcBP9UAWXX3Pyz0v1gG+KQDARvsMHFB
 L5OQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719829253; x=1720434053;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=DxxOz3Ix5iZMRpuo5zvbkarI2Z3ye1tCtWQl2oykLNY=;
 b=d0NF4TVDbc3rqHjwRZEa0RwHka8l9XrKR4hIl1Wb437oDJ7bz9gj9NvZO307zj+Dtw
 Bl/eCH2x/BsDxhpCECXyyp+ukqKNFT9k9Gl+KqF984GklSDiaHutSd7Nq3h1ewC6adrM
 71NBAuu0942eC8K+hSsAty48AyfzqZAmE+2l9fs7ROwuKxFx4P3tDlUCU5U5AzdFbgf1
 16oKY0Vkt12hYKC4q37X4X9kRZw4ThHU7fcugt406z3N67UmqcI/35TXEhVhLcsA8Wch
 MiXInCtRU0CKNxSmd7T0MQ0e/6obtWt1SaOTzHhMe/jkpc5eG26sRgvSNBnHkf8BG2nw
 k5qQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCWRQQCwMo2cCUHWqUGp9Z1cQeHZKdl2zm+XCPdvA8OFCZzm2BKCv9xuBtCJnOi17CcbvM3ccnojTI1xmUVEAfB5HtzwWRk=
X-Gm-Message-State: AOJu0YysuGIjqdJzyooB3lLQFan/K43ZsB5hsv/BGz3LtuWct8cf/bxb
 gMspcd0nCupOs6TzWfRx1fuubDLZ+PBd7EfHmqPiD8rX7/wHNY6A
X-Google-Smtp-Source: AGHT+IG8Nt5iyIs//kTCNrtsGjJJ0crUi+xQ7G/BImoObjV3oqmmcxn+fjBuqm3lezclqmSdqTpRCQ==
X-Received: by 2002:a17:906:ca5b:b0:a72:52f0:900a with SMTP id
 a640c23a62f3a-a751441da57mr332749166b.19.1719829253046; 
 Mon, 01 Jul 2024 03:20:53 -0700 (PDT)
Received: from 3-191.divsi.unimi.it (3-191.divsi.unimi.it. [159.149.3.191])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-a72ab0651dfsm324609566b.142.2024.07.01.03.20.52
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 01 Jul 2024 03:20:52 -0700 (PDT)
From: Vincenzo Pupillo <v.pupillo@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
Date: Mon, 01 Jul 2024 12:20:51 +0200
Message-ID: <2369904.vFx2qVVIhK@HIDDEN>
In-Reply-To: <8F34C3E2-E5C7-48B7-9DCA-249C423F83F6@HIDDEN>
References: <86h6dny3om.fsf@HIDDEN> <2331247.vFx2qVVIhK@fedora>
 <8F34C3E2-E5C7-48B7-9DCA-249C423F83F6@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71681
Cc: Bug Report Emacs <bug-gnu-emacs@HIDDEN>, 71681 <at> debbugs.gnu.org,
 Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Thank you Yuan!
Vincenzo

In data luned=C3=AC 1 luglio 2024 07:37:40 CEST, Yuan Fu ha scritto:
>=20
> > On Jun 30, 2024, at 12:22=E2=80=AFPM, Vincenzo Pupillo <v.pupillo@gmail=
=2Ecom> wrote:
> >=20
> > Today I did a git pull of the master branch.
> > Is it possible that this patch is the cause of this error?
> >=20
> > Error muted by safe_call: (treesit--font-lock-mark-ranges-to-fontify ((=
1 .=20
> > 8867)) #<treesit-parser for php>) signaled (wrong-type-argument treesit=
=2Dnode-p=20
> > #<treesit-parser for php>)
> > Error during redisplay: (jit-lock-function 1) signaled (wrong-type-argu=
ment=20
> > treesit-node-p #<treesit-parser for php>)
> >=20
> > Vincenzo
>=20
> Embarrassingly, yes. I made a typo and didn=E2=80=99t catch it. It should=
 be fixed now (on emacs-30).
>=20
> Yuan
>=20







Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Jul 2024 10:20:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 01 06:20:59 2024
Received: from localhost ([127.0.0.1]:60189 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sOE9b-0004AU-A1
	for submit <at> debbugs.gnu.org; Mon, 01 Jul 2024 06:20:59 -0400
Received: from lists.gnu.org ([209.51.188.17]:50180)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <v.pupillo@HIDDEN>) id 1sOE9a-0004AM-0i
 for submit <at> debbugs.gnu.org; Mon, 01 Jul 2024 06:20:58 -0400
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 <v.pupillo@HIDDEN>)
 id 1sOE9Z-0000kt-0a
 for bug-gnu-emacs@HIDDEN; Mon, 01 Jul 2024 06:20:57 -0400
Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <v.pupillo@HIDDEN>)
 id 1sOE9W-0000Ll-Sp
 for bug-gnu-emacs@HIDDEN; Mon, 01 Jul 2024 06:20:56 -0400
Received: by mail-ej1-x62d.google.com with SMTP id
 a640c23a62f3a-a72585032f1so316158166b.3
 for <bug-gnu-emacs@HIDDEN>; Mon, 01 Jul 2024 03:20:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719829253; x=1720434053; darn=gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=DxxOz3Ix5iZMRpuo5zvbkarI2Z3ye1tCtWQl2oykLNY=;
 b=hoXsb91dqVnyce6vZWrp9tjKFndcr7uRwf6bWwukTE81M0//Klnas/YSNz9OIHaR9A
 0n6B12DJI5svAV6UoCqA2o0iaQPrXCDIwu3TjMJ6Xv/R2XtjMxd+Z3S9IvDbFFLz5iRZ
 qbj2mhFvvMzQOV3LD8UoOskd8B78rPZ4lwmA12vyqVIdj7OwLnvqEaPUUS4ruogEEp20
 Wspz5Ot3pTSZnsYG54nMa7yLyE0ireDgzJbljZTqtZtyd1zPK+ZaC33cigwG4dR1x7Vz
 61MIG3LkmegZsFKfGyKx5UGCESOWuGE1Q6KMrD5zFwYTiyHZEFLbbbIVHQtdkLUFbfIs
 6dPw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719829253; x=1720434053;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=DxxOz3Ix5iZMRpuo5zvbkarI2Z3ye1tCtWQl2oykLNY=;
 b=T3eyVddQEsbktCapZTESdXDf7c+ke5Zxz54SphhTC2GUFZsjWIvli1Fk0e02N5p6el
 CAFsRu0UBm0hgericXKoMPDo46ONhh8lYbU6aIt7XuQo++3seTC76irTSXr+i50ojfgh
 UoSSPUxadunTo5lEJvPU7s1f7mage5bgexjk5so4ibmkpi+6ED5LyMJxcnryuI6oQPro
 Akvb2W5xbbFR9QBnk0u2M1KVqVPKghGm2qUEvsNYXwYZRvOhKcTGrh94qt3LiUOLOQfK
 eM1bPTO5uicZ4j8lTh7hMkwqCEFNLPBfH81qVjmPT+t3/+BDik4aqUEJnf8TVtc1FKCe
 8isw==
X-Forwarded-Encrypted: i=1;
 AJvYcCWGBEuLL07x1cHYrdozQtqr5IAYAOyQgkz1IV6agPpeBa19TaHnX/3e0as8tiI+GHZ9O+3HZz5Kvk+InRSgZU2WuuerQGI=
X-Gm-Message-State: AOJu0Yz04zgSzN7/EC+uS/jTwxfkGJjRPq0oi4hEu8FSmC6CyqlnmRM4
 xT9qfJetpYSaMH3DEglQtW919DIYRPq1jWG0dcSAnc7fPCrkb8a/YMmUoa4q
X-Google-Smtp-Source: AGHT+IG8Nt5iyIs//kTCNrtsGjJJ0crUi+xQ7G/BImoObjV3oqmmcxn+fjBuqm3lezclqmSdqTpRCQ==
X-Received: by 2002:a17:906:ca5b:b0:a72:52f0:900a with SMTP id
 a640c23a62f3a-a751441da57mr332749166b.19.1719829253046; 
 Mon, 01 Jul 2024 03:20:53 -0700 (PDT)
Received: from 3-191.divsi.unimi.it (3-191.divsi.unimi.it. [159.149.3.191])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-a72ab0651dfsm324609566b.142.2024.07.01.03.20.52
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 01 Jul 2024 03:20:52 -0700 (PDT)
From: Vincenzo Pupillo <v.pupillo@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
Date: Mon, 01 Jul 2024 12:20:51 +0200
Message-ID: <2369904.vFx2qVVIhK@HIDDEN>
In-Reply-To: <8F34C3E2-E5C7-48B7-9DCA-249C423F83F6@HIDDEN>
References: <86h6dny3om.fsf@HIDDEN> <2331247.vFx2qVVIhK@fedora>
 <8F34C3E2-E5C7-48B7-9DCA-249C423F83F6@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"
Received-SPF: pass client-ip=2a00:1450:4864:20::62d;
 envelope-from=v.pupillo@HIDDEN; helo=mail-ej1-x62d.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,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Bug Report Emacs <bug-gnu-emacs@HIDDEN>, 71681 <at> debbugs.gnu.org,
 Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Thank you Yuan!
Vincenzo

In data luned=C3=AC 1 luglio 2024 07:37:40 CEST, Yuan Fu ha scritto:
>=20
> > On Jun 30, 2024, at 12:22=E2=80=AFPM, Vincenzo Pupillo <v.pupillo@gmail=
=2Ecom> wrote:
> >=20
> > Today I did a git pull of the master branch.
> > Is it possible that this patch is the cause of this error?
> >=20
> > Error muted by safe_call: (treesit--font-lock-mark-ranges-to-fontify ((=
1 .=20
> > 8867)) #<treesit-parser for php>) signaled (wrong-type-argument treesit=
=2Dnode-p=20
> > #<treesit-parser for php>)
> > Error during redisplay: (jit-lock-function 1) signaled (wrong-type-argu=
ment=20
> > treesit-node-p #<treesit-parser for php>)
> >=20
> > Vincenzo
>=20
> Embarrassingly, yes. I made a typo and didn=E2=80=99t catch it. It should=
 be fixed now (on emacs-30).
>=20
> Yuan
>=20







Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at 71681 <at> debbugs.gnu.org:


Received: (at 71681) by debbugs.gnu.org; 1 Jul 2024 07:02:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 01 03:02:39 2024
Received: from localhost ([127.0.0.1]:59966 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sOB3e-0007U3-OF
	for submit <at> debbugs.gnu.org; Mon, 01 Jul 2024 03:02:39 -0400
Received: from mail-pg1-f178.google.com ([209.85.215.178]:59393)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1sOB3c-0007Tu-DA
 for 71681 <at> debbugs.gnu.org; Mon, 01 Jul 2024 03:02:36 -0400
Received: by mail-pg1-f178.google.com with SMTP id
 41be03b00d2f7-71816f36d4dso1824863a12.2
 for <71681 <at> debbugs.gnu.org>; Mon, 01 Jul 2024 00:02:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719817295; x=1720422095; 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=MAu6OgNmIwSZ8omzF83NvZviP4u5hA+Mc6NVTwZKjoc=;
 b=OwxA1Bd6DNe9DUYf1/jVe+U8FM8Xv1HtSY/r+xTKeXir8yN6HNpEcHz9xkw5u53DPC
 rZcuGgHsmK+9dex67ZbPcnsKsgkh8KzqrofZux6w32iSAjRor4vt06q4yBs52c5blYm1
 5WjrJYWs4erbCyPo8Lq+vCu1ExibXDrVD7Sy6JjehJ7AvEjM3F80WuGeWi7CQJDs9FkZ
 QCllmN9hrQGYMz/ZPT69DKzbMWQ6d+G34EjhuCnLiYZI91nfOZMn9mYt/6VDwRJLnjn4
 mhK+7stOdtMsDDqyCU5loH4h934/ba7Z9V0Pvg6W2X7eJ0+ccU2OVW5x9wY3S0peE/jn
 dsaQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719817295; x=1720422095;
 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=MAu6OgNmIwSZ8omzF83NvZviP4u5hA+Mc6NVTwZKjoc=;
 b=lhVLqoEBDn5TBokhPiWKsS44gcQ5iPpWtVALsJDZyo1Jun5sbnOZkUznPhyERiasRO
 sK8XS6tY4qHtxAbBD+2FIA7hJbL4CGKBmeg0xhSqHm9SikFJf9TFSs/NCdWolXBnBEj5
 OD7RVERnsDyve0qFyw/mfF0OXCDChF8l2txgDMMSr9FqFrSCv9IIXb2V521Vq/308g8P
 EsuZmcWAsnthdep2LJXb6TOKYmZcgjCH4jdC2xRhk8AMR6fiPD/LiPdJiM6zVFWwHsy6
 b55dllIjxtw/tcvJN4IpDCp5zRa7rTQNb9F1uaZBQ7xMO6qoxzoNvIfGZzONu99l+8La
 wgyA==
X-Gm-Message-State: AOJu0YwJN61YtDn8kgVFuPkcXw3tlKjrwdShHygBTXpcBuWuLqZkiuYP
 CrQhlm6CZe2w3wAgPYdbSJv6e2TO5pdQUo9siUuiBRdtskqKxWvP
X-Google-Smtp-Source: AGHT+IFYvP0m+5Z8+3pJNvGjiYG5hNNycS6Nmt+ZJMC43Am32zdWJEZO5MnssEr5Ey2I3EG11DZ8JQ==
X-Received: by 2002:a05:6a21:6d96:b0:1be:ca24:964c with SMTP id
 adf61e73a8af0-1bef6109d5bmr8796715637.16.1719817294806; 
 Mon, 01 Jul 2024 00:01:34 -0700 (PDT)
Received: from smtpclient.apple ([2601:646:8f81:6120:f93d:4f92:d77e:eed7])
 by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-70804a89fc9sm5710477b3a.212.2024.07.01.00.01.34
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 01 Jul 2024 00:01:34 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <864j99d2vr.fsf@HIDDEN>
Date: Mon, 1 Jul 2024 00:01:23 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <C5CEE51F-EDFA-4CF2-9D22-3E1242EEC0B8@HIDDEN>
References: <86h6dny3om.fsf@HIDDEN>
 <9D0E4C93-9CCC-4C0E-BDF7-CB6F09132C23@HIDDEN>
 <86o77rpnjz.fsf@HIDDEN>
 <74F62063-1C20-4257-92BA-F2CF02B9A588@HIDDEN>
 <E28313FF-A353-4BB5-BC06-FFD4E5F19385@HIDDEN>
 <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN>
 <864j99d2vr.fsf@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
X-Mailer: Apple Mail (2.3774.600.62)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71681
Cc: 71681 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



> On Jun 30, 2024, at 11:49=E2=80=AFPM, Juri Linkov <juri@HIDDEN> =
wrote:
>=20
>> I reduced the crash to a signal and pushed the fix to emacs-30.
>> Next I=E2=80=99ll make sure the signal is properly handled.
>=20
> Now with the latest emacs-30 at the commit b2c966f8396
> there is another problem:
>=20
> 0. emacs -Q
> 1. eval: (setq backtrace-on-redisplay-error t)
> 2. eval: (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
> 3. C-x v L
> 4. in the *vc-change-log* buffer move point to the commit b2c966f8396
> 5. type D
>=20
> Warning (error): Error in a redisplay Lisp hook.
> See buffer *Redisplay-trace*
>=20
> Error: treesit-node-outdated (#<treesit-node-outdated>)
>  treesit--font-lock-fontify-region-1(#<treesit-node-outdated> =
#<treesit-compiled-query> 99654 99975 nil nil)
>  treesit-font-lock-fontify-region(99654 99975 nil)
>  font-lock-fontify-syntactically-region(99654 99975 nil)
>  font-lock-default-fontify-region(99654 99974 nil)
>  font-lock-fontify-region(99654 99974)
>  font-lock-ensure(99654 99974)
>  diff-syntax-fontify-hunk(122 539 t)
>  diff-syntax-fontify(122 539)
>  diff--font-lock-syntax(539)
>  font-lock-fontify-keywords-region(1 539 nil)
>  font-lock-default-fontify-region(1 539 nil)
>  font-lock-fontify-region(1 539)
>  jit-lock--run-functions(1 539)
>  jit-lock-fontify-now(1 539)
>  jit-lock-function(1)
>  vc-diff-finish(#<buffer *vc-diff*> nil nil)
>  vc-exec-after(#f(compiled-function () #<bytecode =
-0xcd6e6e57937525e>))
>  log-view-diff-common(1 1 t)
>  log-view-diff-changeset(1 1)
>  funcall-interactively(log-view-diff-changeset 1 1)
>  command-execute(log-view-diff-changeset)

Yes, that=E2=80=99s what meant by =E2=80=9Creduced crash to signal=E2=80=9D=
. The crash is fixed, but I need to fix the font-lock code so it can =
handle the signal gracefully (or don=E2=80=99t cause the signal from the =
first place). It=E2=80=99s not yet clear to me why does =
treesit-font-lock-fontify-region end up using an outdated node for =
query.

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at 71681 <at> debbugs.gnu.org:


Received: (at 71681) by debbugs.gnu.org; 1 Jul 2024 06:50:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 01 02:50:20 2024
Received: from localhost ([127.0.0.1]:59945 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sOArk-00079b-Iv
	for submit <at> debbugs.gnu.org; Mon, 01 Jul 2024 02:50:20 -0400
Received: from relay7-d.mail.gandi.net ([217.70.183.200]:54059)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1sOArd-00079F-Tt
 for 71681 <at> debbugs.gnu.org; Mon, 01 Jul 2024 02:50:18 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 427EA20004;
 Mon,  1 Jul 2024 06:50:04 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
In-Reply-To: <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN> (Yuan Fu's
 message of "Sat, 29 Jun 2024 16:54:39 -0700")
Organization: LINKOV.NET
References: <86h6dny3om.fsf@HIDDEN>
 <9D0E4C93-9CCC-4C0E-BDF7-CB6F09132C23@HIDDEN>
 <86o77rpnjz.fsf@HIDDEN>
 <74F62063-1C20-4257-92BA-F2CF02B9A588@HIDDEN>
 <E28313FF-A353-4BB5-BC06-FFD4E5F19385@HIDDEN>
 <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN>
Date: Mon, 01 Jul 2024 09:49:09 +0300
Message-ID: <864j99d2vr.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 71681
Cc: 71681 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> I reduced the crash to a signal and pushed the fix to emacs-30.
> Next I’ll make sure the signal is properly handled.

Now with the latest emacs-30 at the commit b2c966f8396
there is another problem:

0. emacs -Q
1. eval: (setq backtrace-on-redisplay-error t)
2. eval: (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
3. C-x v L
4. in the *vc-change-log* buffer move point to the commit b2c966f8396
5. type D

Warning (error): Error in a redisplay Lisp hook.
See buffer *Redisplay-trace*

Error: treesit-node-outdated (#<treesit-node-outdated>)
  treesit--font-lock-fontify-region-1(#<treesit-node-outdated> #<treesit-compiled-query> 99654 99975 nil nil)
  treesit-font-lock-fontify-region(99654 99975 nil)
  font-lock-fontify-syntactically-region(99654 99975 nil)
  font-lock-default-fontify-region(99654 99974 nil)
  font-lock-fontify-region(99654 99974)
  font-lock-ensure(99654 99974)
  diff-syntax-fontify-hunk(122 539 t)
  diff-syntax-fontify(122 539)
  diff--font-lock-syntax(539)
  font-lock-fontify-keywords-region(1 539 nil)
  font-lock-default-fontify-region(1 539 nil)
  font-lock-fontify-region(1 539)
  jit-lock--run-functions(1 539)
  jit-lock-fontify-now(1 539)
  jit-lock-function(1)
  vc-diff-finish(#<buffer *vc-diff*> nil nil)
  vc-exec-after(#f(compiled-function () #<bytecode -0xcd6e6e57937525e>))
  log-view-diff-common(1 1 t)
  log-view-diff-changeset(1 1)
  funcall-interactively(log-view-diff-changeset 1 1)
  command-execute(log-view-diff-changeset)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at 71681 <at> debbugs.gnu.org:


Received: (at 71681) by debbugs.gnu.org; 1 Jul 2024 05:39:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 01 01:39:00 2024
Received: from localhost ([127.0.0.1]:59760 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sO9kh-0005Gj-PB
	for submit <at> debbugs.gnu.org; Mon, 01 Jul 2024 01:38:59 -0400
Received: from mail-pl1-f178.google.com ([209.85.214.178]:55483)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1sO9kg-0005GS-HF
 for 71681 <at> debbugs.gnu.org; Mon, 01 Jul 2024 01:38:58 -0400
Received: by mail-pl1-f178.google.com with SMTP id
 d9443c01a7336-1fa07e4f44eso16390005ad.2
 for <71681 <at> debbugs.gnu.org>; Sun, 30 Jun 2024 22:38:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719812272; x=1720417072; 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=xoej28jfbmBViKGdgWd4GhmeQm9Y4hHeGUveSjc+eQg=;
 b=HRqE17hunGQkmxBlWRytT+J3uYjFTfD+qcdmCpaw17S62k7WYUw5zfIk6a0ZJG9ERi
 R3W2FG86Ex71kGx6G5h6JDYh8Pa4RetO9UmGUlRZTW9wtVyIj/AsfBGhto9z1/i/4aoV
 lMkAOFRUV1ixHq//alpT365xg/AIOGZrY/WI08aNx42f40d1/7PbcPRhiy3wBw/n9Ews
 Y89y9OCzCUanNUhgbAcxjr10PKLZP4N7Y/TK/lnaczKIfn8amu+VrSa6IdDpRAdQTq4J
 U/2QFTF12UBqE+DYotqz7FutgpnKxgXIG3uWuwS1QhuwFO9Pox8vonmcjZT33xdXTAml
 JeRg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719812272; x=1720417072;
 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=xoej28jfbmBViKGdgWd4GhmeQm9Y4hHeGUveSjc+eQg=;
 b=G7jyFobLUTDOSUqxWNust37CDtayDAHpvb0bSmcsg8Cnt5HU/16dti/9tK7F9en3bW
 UYEGh9ykMXgQi5VqZ39BLVV5bWJew7zyynVIb0l5XkIYH3eDec/u57HoOZJO8lb1UEmN
 s8jySY7ZPrqyrNIpx8DTli/5VJMOnV7wvC3Hvg2OICvCsw0abofLxTP9r/0LPsN8mOJG
 qvggwV9NeLDmt9t2HiPeXclOVqVZa7WyT+nMQNke5KuGuBtEPzgdvchZSzG/XlHeShTu
 F6K0v8q9EwYLmeGJYKBLpHFMpnUuUZJ+/UftXpZVftPia/A8RZDxHLcWRA+goFYrAdYc
 ZfNA==
X-Forwarded-Encrypted: i=1;
 AJvYcCX8hYkMva0ba7bXL7vXOJ8//CIJBXxcUtntzAvCSsCmXwRK1lmOziNCLUj8loXXE3iDmZDwGXJ5kVRQ2IzhN+RZV8MtkWA=
X-Gm-Message-State: AOJu0YyhxuOlcPSF4cPVOrQDtZq3lBep83pt0p+0ZjzLM46jWYtUrWcu
 vzfmZ3SmV/vJIKaZg1BYl1KJNyS+QdCT3Il67dSNFT+2RjngXttw
X-Google-Smtp-Source: AGHT+IHnR/PDtJEgmBQ0hWKW1HogcF9oHu0XqFfDYZcGV7izromuPPQBXvDIf9XO3WvVHL8h011djg==
X-Received: by 2002:a17:902:f78f:b0:1f9:f3a0:62a5 with SMTP id
 d9443c01a7336-1fadbce7c50mr55324775ad.53.1719812272079; 
 Sun, 30 Jun 2024 22:37:52 -0700 (PDT)
Received: from smtpclient.apple ([2601:646:8f81:6120:f93d:4f92:d77e:eed7])
 by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-1fac1596636sm55281655ad.254.2024.06.30.22.37.51
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 30 Jun 2024 22:37:51 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <2331247.vFx2qVVIhK@fedora>
Date: Sun, 30 Jun 2024 22:37:40 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <8F34C3E2-E5C7-48B7-9DCA-249C423F83F6@HIDDEN>
References: <86h6dny3om.fsf@HIDDEN>
 <E28313FF-A353-4BB5-BC06-FFD4E5F19385@HIDDEN>
 <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN> <2331247.vFx2qVVIhK@fedora>
To: Vincenzo Pupillo <v.pupillo@HIDDEN>
X-Mailer: Apple Mail (2.3774.600.62)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71681
Cc: Bug Report Emacs <bug-gnu-emacs@HIDDEN>, 71681 <at> debbugs.gnu.org,
 Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



> On Jun 30, 2024, at 12:22=E2=80=AFPM, Vincenzo Pupillo =
<v.pupillo@HIDDEN> wrote:
>=20
> Today I did a git pull of the master branch.
> Is it possible that this patch is the cause of this error?
>=20
> Error muted by safe_call: (treesit--font-lock-mark-ranges-to-fontify =
((1 .=20
> 8867)) #<treesit-parser for php>) signaled (wrong-type-argument =
treesit-node-p=20
> #<treesit-parser for php>)
> Error during redisplay: (jit-lock-function 1) signaled =
(wrong-type-argument=20
> treesit-node-p #<treesit-parser for php>)
>=20
> Vincenzo

Embarrassingly, yes. I made a typo and didn=E2=80=99t catch it. It =
should be fixed now (on emacs-30).

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Jul 2024 05:37:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 01 01:37:57 2024
Received: from localhost ([127.0.0.1]:59755 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sO9jh-0005Eo-DH
	for submit <at> debbugs.gnu.org; Mon, 01 Jul 2024 01:37:57 -0400
Received: from lists.gnu.org ([209.51.188.17]:44424)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1sO9jg-0005Eh-7c
 for submit <at> debbugs.gnu.org; Mon, 01 Jul 2024 01:37:56 -0400
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 <casouri@HIDDEN>) id 1sO9jf-00006G-Cf
 for bug-gnu-emacs@HIDDEN; Mon, 01 Jul 2024 01:37:55 -0400
Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <casouri@HIDDEN>) id 1sO9jd-00061u-Om
 for bug-gnu-emacs@HIDDEN; Mon, 01 Jul 2024 01:37:55 -0400
Received: by mail-pl1-x62c.google.com with SMTP id
 d9443c01a7336-1fa2ea1c443so19493565ad.0
 for <bug-gnu-emacs@HIDDEN>; Sun, 30 Jun 2024 22:37:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719812272; x=1720417072; darn=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=xoej28jfbmBViKGdgWd4GhmeQm9Y4hHeGUveSjc+eQg=;
 b=d5TuMvKoiqVgP9Vy2YL74W3/7Mq1c+Jpy8N9Y0SUgAa+XGQoeZW/59TWVixtKxtifX
 Oe33yWklMtXbjczcCLkqnuT1sY9haNHafQdbuilSIK62dyWueq1f0Vkg1vzjielvLxXX
 CgRa9dAc3VaWQNwedS608NpWd81iy4wLKFpCsQOi8EkKy9aLgJzd95s19qwQP6z+lMsQ
 H+aM2JocTJVzau9m14AUtI2Z4hEjFX+IjY8TZvZdqhLUxE/4XERpqgZ9oe74kEqFAa2L
 8aeUvHs+96KvZ6kRwMQSF1auF4PU6UGC6VDOPNs1LewQw6QihI2uGfZbnXMZpsOlru+M
 KNXw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719812272; x=1720417072;
 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=xoej28jfbmBViKGdgWd4GhmeQm9Y4hHeGUveSjc+eQg=;
 b=Wwa2LG+lGzD0Hy3Oz8bQdcEnpEUwIR9UK2R8r1qG7FJYmNZdnG703YgcNwI7AhwnFH
 bgEO2oofa+acTY6v8xcWholRkguPRAG8pF1IQl55C2YrOdeZvAudP9qUj9meBb7a6k+Y
 3sWuROAyRPQjLHiHPSTnhBpJT8+qZ/4kVbFOpsaBlKlwTTlx8savlk30Z42kchg8FcMf
 K2EKWuG53U8ATJs+fGNmOABKJOpgtw9BakcT3GDbuhT4e74cZ5t5szZDPac5ZBAeBGsW
 CniPAf1Q/qQ5fr58lJx5S9+/dns+8VRCLed2wMx6I+Els8amoRIT4V4AHTwsxNUsWmuv
 L/jQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCWPoqaQW661pti776W/ZE2Qn2Fi57Y3C1yz+egErxi3mM+J0Y28I2UbMjTjIwvqP+v5QsnfPJB1HLf+vfBgUK9wqHYZbAs=
X-Gm-Message-State: AOJu0YyRuzItjH9JmQtsJUYb9QeNWGwdaszELU+fmOvX6viUYb7vFL3r
 5hS6lhT9KB+zm/R9uLJSEjM1//u//bz8m3gLcU0WniZ2C72esX6j
X-Google-Smtp-Source: AGHT+IHnR/PDtJEgmBQ0hWKW1HogcF9oHu0XqFfDYZcGV7izromuPPQBXvDIf9XO3WvVHL8h011djg==
X-Received: by 2002:a17:902:f78f:b0:1f9:f3a0:62a5 with SMTP id
 d9443c01a7336-1fadbce7c50mr55324775ad.53.1719812272079; 
 Sun, 30 Jun 2024 22:37:52 -0700 (PDT)
Received: from smtpclient.apple ([2601:646:8f81:6120:f93d:4f92:d77e:eed7])
 by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-1fac1596636sm55281655ad.254.2024.06.30.22.37.51
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 30 Jun 2024 22:37:51 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <2331247.vFx2qVVIhK@fedora>
Date: Sun, 30 Jun 2024 22:37:40 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <8F34C3E2-E5C7-48B7-9DCA-249C423F83F6@HIDDEN>
References: <86h6dny3om.fsf@HIDDEN>
 <E28313FF-A353-4BB5-BC06-FFD4E5F19385@HIDDEN>
 <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN> <2331247.vFx2qVVIhK@fedora>
To: Vincenzo Pupillo <v.pupillo@HIDDEN>
X-Mailer: Apple Mail (2.3774.600.62)
Received-SPF: pass client-ip=2607:f8b0:4864:20::62c;
 envelope-from=casouri@HIDDEN; helo=mail-pl1-x62c.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,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Bug Report Emacs <bug-gnu-emacs@HIDDEN>, 71681 <at> debbugs.gnu.org,
 Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)



> On Jun 30, 2024, at 12:22=E2=80=AFPM, Vincenzo Pupillo =
<v.pupillo@HIDDEN> wrote:
>=20
> Today I did a git pull of the master branch.
> Is it possible that this patch is the cause of this error?
>=20
> Error muted by safe_call: (treesit--font-lock-mark-ranges-to-fontify =
((1 .=20
> 8867)) #<treesit-parser for php>) signaled (wrong-type-argument =
treesit-node-p=20
> #<treesit-parser for php>)
> Error during redisplay: (jit-lock-function 1) signaled =
(wrong-type-argument=20
> treesit-node-p #<treesit-parser for php>)
>=20
> Vincenzo

Embarrassingly, yes. I made a typo and didn=E2=80=99t catch it. It =
should be fixed now (on emacs-30).

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at 71681 <at> debbugs.gnu.org:


Received: (at 71681) by debbugs.gnu.org; 30 Jun 2024 19:23:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 30 15:23:18 2024
Received: from localhost ([127.0.0.1]:59139 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sO08s-0002m5-2O
	for submit <at> debbugs.gnu.org; Sun, 30 Jun 2024 15:23:18 -0400
Received: from mail-lf1-f51.google.com ([209.85.167.51]:54537)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <v.pupillo@HIDDEN>) id 1sO08p-0002ln-Ma
 for 71681 <at> debbugs.gnu.org; Sun, 30 Jun 2024 15:23:16 -0400
Received: by mail-lf1-f51.google.com with SMTP id
 2adb3069b0e04-52cdfb69724so2831011e87.1
 for <71681 <at> debbugs.gnu.org>; Sun, 30 Jun 2024 12:23:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719775329; x=1720380129; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=YAp8aCFvHnb3pV1dewhzoQ2ljD8HZMV5DmVna7+zUSM=;
 b=OERhYMjHbr7VlXpY9in2fHev8kFgct0/RjBpIXh/EDKSAs9qhnwp1cmNqopsHib7WY
 aoy9UbbVlID+5HrgeZNMQ35Tn+2oUcRfrwBqWQmKYCZNcEj/vnH9Rm9H08GB/srJBOf8
 HUK28fRo1PrxKve7rPAUpMHIi+LyjJ24LxlPx3kwkSFH2GnoKFDL++PMM7yKB1/4LvfE
 p85iA4JImJ58dnTpXWSKX2YJD2RVl/IiX1vPObbHsbfXFmtE/PPkdjODwnCw4nrS/wZY
 q2AmFGpJB2U8HTotxnt1GvS1+r6Gqyz5aldUkvEBCDWo9BPjZTsxEamwgzvGNv/ZS0Y4
 SKuA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719775329; x=1720380129;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=YAp8aCFvHnb3pV1dewhzoQ2ljD8HZMV5DmVna7+zUSM=;
 b=p0uNyQQhLJ7AMow5qlLb0Em4yOwkJfg1zxGIw6uOGpdtquX3CP/3m+py4rRmtD3H0e
 zY7C9q8dlnXypw07w050F97dWA5oU+cNHyACc2Ilas/jxNWdwDf9q0IaUWkx9ZxdK4pm
 cDtLrJeUpmtVQrX8QuH2o9Et2HxlC8xIo3+2TjTpYmMYLmMWrXwep0HcBtAqxMCkDF46
 Yv2fWwuHaXgjVF5PrNNGhVHObdTIv4nqXL9hsUu2D9ewGOQgRbwFYgwNEhvyS63y4dwc
 4qROm8P1d1FY/O4q4hWNZtXQhmpUXPoh5885ZE5y9rE4Vppd5UGi1Y3Fwd6NcTEekaBv
 jSdg==
X-Gm-Message-State: AOJu0YybkjnJTamkHYP8iACI5I2UJupLFebFNCBhtKhKnGaBvBOecgd4
 AZgm2pnmtrsBewaUnbhkD1rDGQs9Kp4TfyxwSvDhDkpP/bMGcALa
X-Google-Smtp-Source: AGHT+IFySyKG7EhfRhewJv1fDzW/afOEdgTyMXk0FgIzPf3szhBQ22O/azTAKnBNvMA3O9z2uFv9bg==
X-Received: by 2002:a05:6512:31c8:b0:52c:d84c:1182 with SMTP id
 2adb3069b0e04-52e82744dc0mr2593075e87.64.1719775329217; 
 Sun, 30 Jun 2024 12:22:09 -0700 (PDT)
Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it.
 [2.230.139.124]) by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-a72aaf63909sm265225466b.77.2024.06.30.12.22.08
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 30 Jun 2024 12:22:08 -0700 (PDT)
From: Vincenzo Pupillo <v.pupillo@HIDDEN>
To: Juri Linkov <juri@HIDDEN>, bug-gnu-emacs@HIDDEN
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
Date: Sun, 30 Jun 2024 21:22:07 +0200
Message-ID: <2331247.vFx2qVVIhK@fedora>
In-Reply-To: <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN>
References: <86h6dny3om.fsf@HIDDEN>
 <E28313FF-A353-4BB5-BC06-FFD4E5F19385@HIDDEN>
 <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71681
Cc: Yuan Fu <casouri@HIDDEN>, 71681 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Today I did a git pull of the master branch.
Is it possible that this patch is the cause of this error?

Error muted by safe_call: (treesit--font-lock-mark-ranges-to-fontify ((1 .=
=20
8867)) #<treesit-parser for php>) signaled (wrong-type-argument treesit-nod=
e-p=20
#<treesit-parser for php>)
Error during redisplay: (jit-lock-function 1) signaled (wrong-type-argument=
=20
treesit-node-p #<treesit-parser for php>)

Vincenzo

In data domenica 30 giugno 2024 01:54:39 CEST, Yuan Fu ha scritto:
> > On Jun 25, 2024, at 11:04=E2=80=AFPM, Yuan Fu <casouri@HIDDEN> wrote:
> >> On Jun 24, 2024, at 12:46=E2=80=AFAM, Yuan Fu <casouri@HIDDEN> wrot=
e:
> >>> On Jun 23, 2024, at 10:38=E2=80=AFAM, Juri Linkov <juri@HIDDEN> w=
rote:
> >>>>> Evaluating this expression causes a crash:
> >>>>>=20
> >>>>> (progn
> >>>>> (find-file (expand-file-name "src/treesit.c" installation-directory=
))
> >>>>> (c-ts-mode)
> >>>>> (font-lock-ensure 63209 63387))
> >>>>>=20
> >>>>> in latest master, but not in latest emacs-29 (only in 5-months old
> >>>>> emacs-29).
> >>>>>=20
> >>>>> If this is not reproducible, I could provide more details.
> >>>>>=20
> >>>>> libtree-sitter is at the latest version.
> >>>>=20
> >>>> Hmm, I can=E2=80=99t reproduce with latest master and libtree-sitter=
=2E Maybe you
> >>>> can send me the exact commits that you used?
> >>>>=20
> >>>> Here=E2=80=99s mine:
> >>>>=20
> >>>> Emacs: 72f2b01e318
> >>>> Tree-sitter: 6ec478c1
> >>>=20
> >>> Probably reproducibility depends on the content of the src/treesit.c
> >>> file.
> >>> Then the most reliable way to reproduce it is this:
> >>>=20
> >>> 0. emacs -Q
> >>> 1. eval: (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
> >>> 2. C-x v L
> >>> 3. in the *vc-change-log* buffer move point to the commit 20af58d3a13
> >>> 4. type D
> >>> 5. crash caused by diff-font-lock-syntax fontification that uses tree=
sit
> >>>=20
> >>> The numbers in (font-lock-ensure 63209 63387) above were extracted
> >>> from diff hunk boundaries that might be different when the file was
> >>> edited.
> >>=20
> >> I reproduce it once with the first set of commits you provided, but for
> >> some reason couldn=E2=80=99t reproduce it again. I=E2=80=99m sure it=
=E2=80=99s something wrong
> >> that I did. I=E2=80=99ll report back when I make progress. TBH it seem=
s like
> >> something wrong with tree-sitter itself, but I=E2=80=99ll make sure to=
 figure
> >> out what=E2=80=99s the problem exactly.
> >>=20
> >> Yuan
> >=20
> > Ok, I can reproduce it now. Looking into it=E2=80=A6
>=20
> Finally figured out why. It=E2=80=99s not tree-sitter=E2=80=99s problem, =
but ours. I reduced
> the crash to a signal and pushed the fix to emacs-30. Next I=E2=80=99ll m=
ake sure
> the signal is properly handled. Below quoting the commit message:
>=20
> The immediate cause of the crash is that tree-sitter accessed a node's
> tree, but the tree is already deleted.
>=20
> What happended, I think, is this:
>=20
> 1. Buffer modified, parser->need_reparse set to true,
> parser->timestamp incremented.
> 2. A node is created from the parser, this node has the old tree but
> the _new_ timestamp (bad!).
> 3. Parser re-parses (treesit_ensure_parsed), new tree created, old
> tree deleted.
> 4. Ftreesit_query_capture accessed the old node, and the old tree,
> crash.
>=20
> We shouldn't bump the parser timestamp when we set
> parser->need_reparse to true; instead, we should bump the timestamp
> when we actually reparsed and created a new tree.
>=20
> Yuan











Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 30 Jun 2024 19:22:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 30 15:22:17 2024
Received: from localhost ([127.0.0.1]:59135 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sO07s-0002k1-HC
	for submit <at> debbugs.gnu.org; Sun, 30 Jun 2024 15:22:16 -0400
Received: from lists.gnu.org ([209.51.188.17]:50944)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <v.pupillo@HIDDEN>) id 1sO07p-0002js-Ko
 for submit <at> debbugs.gnu.org; Sun, 30 Jun 2024 15:22:15 -0400
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 <v.pupillo@HIDDEN>)
 id 1sO07p-0001i9-AZ
 for bug-gnu-emacs@HIDDEN; Sun, 30 Jun 2024 15:22:13 -0400
Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <v.pupillo@HIDDEN>)
 id 1sO07n-0004qa-Lq
 for bug-gnu-emacs@HIDDEN; Sun, 30 Jun 2024 15:22:13 -0400
Received: by mail-lj1-x233.google.com with SMTP id
 38308e7fff4ca-2ebe40673e8so26072141fa.3
 for <bug-gnu-emacs@HIDDEN>; Sun, 30 Jun 2024 12:22:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719775329; x=1720380129; darn=gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=YAp8aCFvHnb3pV1dewhzoQ2ljD8HZMV5DmVna7+zUSM=;
 b=Yd++WDMhb76Nxx7Q6syZAlRbIUa8FJqYwtlBM1UOEx+5dBbJ3aByDZByO798h+5WLj
 zCdUVm/OD0WJpB6gKbnRAlXwnKEOPS4a40+t+vXotaUi/n8QEFAbmwwfE7+vjynusEq7
 nNE6b8U3ekCVg0GmbMrg7KX7GvG6TVoVTrEpHGqFOHlmJ4IIUbvQ5DmtjYueGqVmzt5Z
 ZGdblXd2G3J2kOVzQQu6oFJtDjuu3GsEeWoCIjw8G2FhxLp5G+7dElpRb9pVktMKzSbn
 BEnXTTX4TRd2twuG0AbWSgLvLvKBiqHXr6AR71u/54Oyw2Vnru52H1mu0+a+7KgtA9OY
 KAQw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719775329; x=1720380129;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=YAp8aCFvHnb3pV1dewhzoQ2ljD8HZMV5DmVna7+zUSM=;
 b=G9PXs6KMibV1zTkPkuAiIC37YMKP2bjw09Q0ja83hwODupBKwLWzLqWm6irVNhGWRN
 SSKHerxcCvcYUcVdiiX0mU92iatiwxDSjUUnDSDzyYz3xZycQJISwEcHFl5tnnM4NVOc
 pYLS1F97/mRv3PLpX/BuYTlRWYEBLg6BIvow4PNJMIYsxGxa8RMPojSRvPLf8qFmDHd2
 oIaT5iw3K+5v0WiBd5jX7L7puAdv7PL2vAqUikqNNLEG/aWBvugo4FU8fcDr5mGxPsTv
 r9MroHM3KfZr1VWiJpsg9vpTGZbuR8SvA42GHsGzhjGUZ248BmYux9ZqCF2sE2R8T/Y0
 J6zw==
X-Forwarded-Encrypted: i=1;
 AJvYcCXBOrtUDiOCm/S2YjnNYTW+OSdSYQG5pNdPdV3AlGkBNT5EXLc7N5LLPekBUlD2OeVP/LU8IMhEPeQp5/18Y9MAd6SYJ/s=
X-Gm-Message-State: AOJu0YzD0CiK0FJPmw5gl+GsHlrnf7efdX4tq6KHMFMf567bNm2r3RXB
 khpRgKCP6GpOIZHUhNyv3gckzwzmMvHtCchSGE4E3ZbwBFEc0ZekHZaXH305wSk=
X-Google-Smtp-Source: AGHT+IFySyKG7EhfRhewJv1fDzW/afOEdgTyMXk0FgIzPf3szhBQ22O/azTAKnBNvMA3O9z2uFv9bg==
X-Received: by 2002:a05:6512:31c8:b0:52c:d84c:1182 with SMTP id
 2adb3069b0e04-52e82744dc0mr2593075e87.64.1719775329217; 
 Sun, 30 Jun 2024 12:22:09 -0700 (PDT)
Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it.
 [2.230.139.124]) by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-a72aaf63909sm265225466b.77.2024.06.30.12.22.08
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 30 Jun 2024 12:22:08 -0700 (PDT)
From: Vincenzo Pupillo <v.pupillo@HIDDEN>
To: Juri Linkov <juri@HIDDEN>, bug-gnu-emacs@HIDDEN
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
Date: Sun, 30 Jun 2024 21:22:07 +0200
Message-ID: <2331247.vFx2qVVIhK@fedora>
In-Reply-To: <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN>
References: <86h6dny3om.fsf@HIDDEN>
 <E28313FF-A353-4BB5-BC06-FFD4E5F19385@HIDDEN>
 <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"
Received-SPF: pass client-ip=2a00:1450:4864:20::233;
 envelope-from=v.pupillo@HIDDEN; helo=mail-lj1-x233.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,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Yuan Fu <casouri@HIDDEN>, 71681 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Today I did a git pull of the master branch.
Is it possible that this patch is the cause of this error?

Error muted by safe_call: (treesit--font-lock-mark-ranges-to-fontify ((1 .=
=20
8867)) #<treesit-parser for php>) signaled (wrong-type-argument treesit-nod=
e-p=20
#<treesit-parser for php>)
Error during redisplay: (jit-lock-function 1) signaled (wrong-type-argument=
=20
treesit-node-p #<treesit-parser for php>)

Vincenzo

In data domenica 30 giugno 2024 01:54:39 CEST, Yuan Fu ha scritto:
> > On Jun 25, 2024, at 11:04=E2=80=AFPM, Yuan Fu <casouri@HIDDEN> wrote:
> >> On Jun 24, 2024, at 12:46=E2=80=AFAM, Yuan Fu <casouri@HIDDEN> wrot=
e:
> >>> On Jun 23, 2024, at 10:38=E2=80=AFAM, Juri Linkov <juri@HIDDEN> w=
rote:
> >>>>> Evaluating this expression causes a crash:
> >>>>>=20
> >>>>> (progn
> >>>>> (find-file (expand-file-name "src/treesit.c" installation-directory=
))
> >>>>> (c-ts-mode)
> >>>>> (font-lock-ensure 63209 63387))
> >>>>>=20
> >>>>> in latest master, but not in latest emacs-29 (only in 5-months old
> >>>>> emacs-29).
> >>>>>=20
> >>>>> If this is not reproducible, I could provide more details.
> >>>>>=20
> >>>>> libtree-sitter is at the latest version.
> >>>>=20
> >>>> Hmm, I can=E2=80=99t reproduce with latest master and libtree-sitter=
=2E Maybe you
> >>>> can send me the exact commits that you used?
> >>>>=20
> >>>> Here=E2=80=99s mine:
> >>>>=20
> >>>> Emacs: 72f2b01e318
> >>>> Tree-sitter: 6ec478c1
> >>>=20
> >>> Probably reproducibility depends on the content of the src/treesit.c
> >>> file.
> >>> Then the most reliable way to reproduce it is this:
> >>>=20
> >>> 0. emacs -Q
> >>> 1. eval: (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
> >>> 2. C-x v L
> >>> 3. in the *vc-change-log* buffer move point to the commit 20af58d3a13
> >>> 4. type D
> >>> 5. crash caused by diff-font-lock-syntax fontification that uses tree=
sit
> >>>=20
> >>> The numbers in (font-lock-ensure 63209 63387) above were extracted
> >>> from diff hunk boundaries that might be different when the file was
> >>> edited.
> >>=20
> >> I reproduce it once with the first set of commits you provided, but for
> >> some reason couldn=E2=80=99t reproduce it again. I=E2=80=99m sure it=
=E2=80=99s something wrong
> >> that I did. I=E2=80=99ll report back when I make progress. TBH it seem=
s like
> >> something wrong with tree-sitter itself, but I=E2=80=99ll make sure to=
 figure
> >> out what=E2=80=99s the problem exactly.
> >>=20
> >> Yuan
> >=20
> > Ok, I can reproduce it now. Looking into it=E2=80=A6
>=20
> Finally figured out why. It=E2=80=99s not tree-sitter=E2=80=99s problem, =
but ours. I reduced
> the crash to a signal and pushed the fix to emacs-30. Next I=E2=80=99ll m=
ake sure
> the signal is properly handled. Below quoting the commit message:
>=20
> The immediate cause of the crash is that tree-sitter accessed a node's
> tree, but the tree is already deleted.
>=20
> What happended, I think, is this:
>=20
> 1. Buffer modified, parser->need_reparse set to true,
> parser->timestamp incremented.
> 2. A node is created from the parser, this node has the old tree but
> the _new_ timestamp (bad!).
> 3. Parser re-parses (treesit_ensure_parsed), new tree created, old
> tree deleted.
> 4. Ftreesit_query_capture accessed the old node, and the old tree,
> crash.
>=20
> We shouldn't bump the parser timestamp when we set
> parser->need_reparse to true; instead, we should bump the timestamp
> when we actually reparsed and created a new tree.
>=20
> Yuan











Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at 71681 <at> debbugs.gnu.org:


Received: (at 71681) by debbugs.gnu.org; 30 Jun 2024 16:38:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 30 12:38:23 2024
Received: from localhost ([127.0.0.1]:58838 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sNxZH-0003pi-MP
	for submit <at> debbugs.gnu.org; Sun, 30 Jun 2024 12:38:23 -0400
Received: from relay2-d.mail.gandi.net ([217.70.183.194]:39389)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1sNxZF-0003pS-MM
 for 71681 <at> debbugs.gnu.org; Sun, 30 Jun 2024 12:38:22 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id E44EC40002;
 Sun, 30 Jun 2024 16:37:54 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
In-Reply-To: <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN> (Yuan Fu's
 message of "Sat, 29 Jun 2024 16:54:39 -0700")
Organization: LINKOV.NET
References: <86h6dny3om.fsf@HIDDEN>
 <9D0E4C93-9CCC-4C0E-BDF7-CB6F09132C23@HIDDEN>
 <86o77rpnjz.fsf@HIDDEN>
 <74F62063-1C20-4257-92BA-F2CF02B9A588@HIDDEN>
 <E28313FF-A353-4BB5-BC06-FFD4E5F19385@HIDDEN>
 <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN>
Date: Sun, 30 Jun 2024 19:15:28 +0300
Message-ID: <86cynyrixj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 71681
Cc: 71681 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> Finally figured out why. It’s not tree-sitter’s problem, but
> ours. I reduced the crash to a signal and pushed the fix to
> emacs-30. Next I’ll make sure the signal is properly handled. Below
> quoting the commit message:
>
> The immediate cause of the crash is that tree-sitter accessed a node's
> tree, but the tree is already deleted.
>
> What happended, I think, is this:
>
> 1. Buffer modified, parser->need_reparse set to true,
> parser->timestamp incremented.
> 2. A node is created from the parser, this node has the old tree but
> the _new_ timestamp (bad!).
> 3. Parser re-parses (treesit_ensure_parsed), new tree created, old
> tree deleted.
> 4. Ftreesit_query_capture accessed the old node, and the old tree,
> crash.
>
> We shouldn't bump the parser timestamp when we set
> parser->need_reparse to true; instead, we should bump the timestamp
> when we actually reparsed and created a new tree.

Thank you very much.  I confirm there are no crashes anymore.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at 71681 <at> debbugs.gnu.org:


Received: (at 71681) by debbugs.gnu.org; 30 Jun 2024 14:29:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 30 10:29:58 2024
Received: from localhost ([127.0.0.1]:58622 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sNvZ0-0005rF-7X
	for submit <at> debbugs.gnu.org; Sun, 30 Jun 2024 10:29:58 -0400
Received: from mail-ej1-f48.google.com ([209.85.218.48]:55322)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <v.pupillo@HIDDEN>) id 1sNvYx-0005r6-S8
 for 71681 <at> debbugs.gnu.org; Sun, 30 Jun 2024 10:29:56 -0400
Received: by mail-ej1-f48.google.com with SMTP id
 a640c23a62f3a-a689ad8d1f6so250447966b.2
 for <71681 <at> debbugs.gnu.org>; Sun, 30 Jun 2024 07:29:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719757735; x=1720362535; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=YAp8aCFvHnb3pV1dewhzoQ2ljD8HZMV5DmVna7+zUSM=;
 b=SljGRjyK9PARvdkVnIlMDVZRvEfbS762tQ4KtlZ/ezRVgxnk/aNglG8ge/n5TCU9nJ
 gdtylJxV/NCXZeZJr1nyqMy8Q/oiHNyra2PbSa8/HcnSr8X6l4WfK0I1B7xhTHKIIpnK
 6vrmIFJ26xLe5//MoNIAxfMea4dnXX/5bu4jYtJ/y2sj4RjEKDV28ISa4muX8fXFOZuZ
 Ngor0kGCG1mOCiKmR92qle2ZZlYnD0skf6J8n5e+VgClq/OwAl5Fv/Y7OQbPxNdWmKjT
 JuD9oKc9XRIU9ti3mpwFd+zoI50cXG3CrY880q7ydN6zUCj//sajEvfFTFISzBtKCVvb
 EJCw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719757735; x=1720362535;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=YAp8aCFvHnb3pV1dewhzoQ2ljD8HZMV5DmVna7+zUSM=;
 b=detD0BmHT1YNUuviF8HxtcD+zrT7PYo6dQPpLEqZAmRjTLG8MVybh/wBI5Mt9iz/pU
 ZIiLBpE3CoysAeujrLLjM06rC7YClbB5jwpWBQl4S9e9OLWDbxwHUx2sp12VCZlR0ooh
 XxVKXBSLgjYYNiVAYtqE+DBZ1DqN364AbkdjRZQ8vwaIrz+qyO/MQ8RAgp87x5N18u4a
 kR+kPmBsLDGOL4TGDmHP65LhwRK7IxtWu5aCGptv0fPfYCCCSCVcCK9LMCAuyIj7MLl5
 5rp/t0cbM+ryjswOozafurD9/bZhEZ6o5h0KM6YYoOU0p45C7m6PkEXMvq1+8KJYjj0z
 UOmg==
X-Gm-Message-State: AOJu0YzgtoE8EtN0zIB6xXV30KcQdDwYE/OJgrxtI8TFLqcfzHqZYDPn
 8SnHnAWdlMafL9vuTxpbxo3lM0hL9jM3UxMDXD2+z5aHScKlMsrh
X-Google-Smtp-Source: AGHT+IEt+PhydDjLXFZ13npeF1vfQrVSe2rTVHMPU4y/rDH1nWH4slEv8GghOdVSFW90AptWznuP/g==
X-Received: by 2002:a17:907:104b:b0:a72:65e5:3e7 with SMTP id
 a640c23a62f3a-a7514441510mr201068166b.55.1719757734714; 
 Sun, 30 Jun 2024 07:28:54 -0700 (PDT)
Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it.
 [2.230.139.124]) by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-a72aaf1843fsm244440666b.39.2024.06.30.07.28.54
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 30 Jun 2024 07:28:54 -0700 (PDT)
From: Vincenzo Pupillo <v.pupillo@HIDDEN>
To: Juri Linkov <juri@HIDDEN>, bug-gnu-emacs@HIDDEN
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
Date: Sun, 30 Jun 2024 16:28:53 +0200
Message-ID: <4943193.OV4Wx5bFTl@fedora>
In-Reply-To: <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN>
References: <86h6dny3om.fsf@HIDDEN>
 <E28313FF-A353-4BB5-BC06-FFD4E5F19385@HIDDEN>
 <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71681
Cc: Yuan Fu <casouri@HIDDEN>, 71681 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Today I did a git pull of the master branch.
Is it possible that this patch is the cause of this error?

Error muted by safe_call: (treesit--font-lock-mark-ranges-to-fontify ((1 .=
=20
8867)) #<treesit-parser for php>) signaled (wrong-type-argument treesit-nod=
e-p=20
#<treesit-parser for php>)
Error during redisplay: (jit-lock-function 1) signaled (wrong-type-argument=
=20
treesit-node-p #<treesit-parser for php>)

Vincenzo

In data domenica 30 giugno 2024 01:54:39 CEST, Yuan Fu ha scritto:
> > On Jun 25, 2024, at 11:04=E2=80=AFPM, Yuan Fu <casouri@HIDDEN> wrote:
> >> On Jun 24, 2024, at 12:46=E2=80=AFAM, Yuan Fu <casouri@HIDDEN> wrot=
e:
> >>> On Jun 23, 2024, at 10:38=E2=80=AFAM, Juri Linkov <juri@HIDDEN> w=
rote:
> >>>>> Evaluating this expression causes a crash:
> >>>>>=20
> >>>>> (progn
> >>>>> (find-file (expand-file-name "src/treesit.c" installation-directory=
))
> >>>>> (c-ts-mode)
> >>>>> (font-lock-ensure 63209 63387))
> >>>>>=20
> >>>>> in latest master, but not in latest emacs-29 (only in 5-months old
> >>>>> emacs-29).
> >>>>>=20
> >>>>> If this is not reproducible, I could provide more details.
> >>>>>=20
> >>>>> libtree-sitter is at the latest version.
> >>>>=20
> >>>> Hmm, I can=E2=80=99t reproduce with latest master and libtree-sitter=
=2E Maybe you
> >>>> can send me the exact commits that you used?
> >>>>=20
> >>>> Here=E2=80=99s mine:
> >>>>=20
> >>>> Emacs: 72f2b01e318
> >>>> Tree-sitter: 6ec478c1
> >>>=20
> >>> Probably reproducibility depends on the content of the src/treesit.c
> >>> file.
> >>> Then the most reliable way to reproduce it is this:
> >>>=20
> >>> 0. emacs -Q
> >>> 1. eval: (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
> >>> 2. C-x v L
> >>> 3. in the *vc-change-log* buffer move point to the commit 20af58d3a13
> >>> 4. type D
> >>> 5. crash caused by diff-font-lock-syntax fontification that uses tree=
sit
> >>>=20
> >>> The numbers in (font-lock-ensure 63209 63387) above were extracted
> >>> from diff hunk boundaries that might be different when the file was
> >>> edited.
> >>=20
> >> I reproduce it once with the first set of commits you provided, but for
> >> some reason couldn=E2=80=99t reproduce it again. I=E2=80=99m sure it=
=E2=80=99s something wrong
> >> that I did. I=E2=80=99ll report back when I make progress. TBH it seem=
s like
> >> something wrong with tree-sitter itself, but I=E2=80=99ll make sure to=
 figure
> >> out what=E2=80=99s the problem exactly.
> >>=20
> >> Yuan
> >=20
> > Ok, I can reproduce it now. Looking into it=E2=80=A6
>=20
> Finally figured out why. It=E2=80=99s not tree-sitter=E2=80=99s problem, =
but ours. I reduced
> the crash to a signal and pushed the fix to emacs-30. Next I=E2=80=99ll m=
ake sure
> the signal is properly handled. Below quoting the commit message:
>=20
> The immediate cause of the crash is that tree-sitter accessed a node's
> tree, but the tree is already deleted.
>=20
> What happended, I think, is this:
>=20
> 1. Buffer modified, parser->need_reparse set to true,
> parser->timestamp incremented.
> 2. A node is created from the parser, this node has the old tree but
> the _new_ timestamp (bad!).
> 3. Parser re-parses (treesit_ensure_parsed), new tree created, old
> tree deleted.
> 4. Ftreesit_query_capture accessed the old node, and the old tree,
> crash.
>=20
> We shouldn't bump the parser timestamp when we set
> parser->need_reparse to true; instead, we should bump the timestamp
> when we actually reparsed and created a new tree.
>=20
> Yuan








Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 30 Jun 2024 14:29:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 30 10:29:03 2024
Received: from localhost ([127.0.0.1]:58619 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sNvY6-0005pj-Nk
	for submit <at> debbugs.gnu.org; Sun, 30 Jun 2024 10:29:03 -0400
Received: from lists.gnu.org ([209.51.188.17]:40268)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <v.pupillo@HIDDEN>) id 1sNvY4-0005pJ-GB
 for submit <at> debbugs.gnu.org; Sun, 30 Jun 2024 10:29:01 -0400
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 <v.pupillo@HIDDEN>)
 id 1sNvY4-0007lC-8s
 for bug-gnu-emacs@HIDDEN; Sun, 30 Jun 2024 10:29:00 -0400
Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <v.pupillo@HIDDEN>)
 id 1sNvY2-0008Jt-Jl
 for bug-gnu-emacs@HIDDEN; Sun, 30 Jun 2024 10:29:00 -0400
Received: by mail-ej1-x62b.google.com with SMTP id
 a640c23a62f3a-a72af03ebdfso283445466b.3
 for <bug-gnu-emacs@HIDDEN>; Sun, 30 Jun 2024 07:28:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719757735; x=1720362535; darn=gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=YAp8aCFvHnb3pV1dewhzoQ2ljD8HZMV5DmVna7+zUSM=;
 b=USIjrpOj3bqfUbo4kq797PSPAg15EzfTAaMqV0wyGXS+hkGshqy+0W+rkIrfWdnNwo
 GXYAbqG0uFLiogBKlvq+Fv/UfcCbvHfAjTjOl9BjyceWb7cQHu2ckebNdOjMe8+dAcYl
 ENX4qHtpT3uxLx4p7Mfo20MteeTsX+6vyVZ5dkIZc4lwBPW8GsW5mqnR5FKeZepR11NN
 NcSxKk0WFQ5++h3eiho0JTtAR0lB3Y/zyoSLTYDlXN+dA7805QLIjH+yQ41G6dvvdDF7
 OxtD0PwH5sYk3cjFCK8uwUgSPuBJgtkNYbwv8l5ruevzzvRpjSxdewXWQ4IatK7J7Clq
 fCyw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719757735; x=1720362535;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=YAp8aCFvHnb3pV1dewhzoQ2ljD8HZMV5DmVna7+zUSM=;
 b=GtTEfp5OsN4mMknBxIfd4PyuYIRLf8NZERZbGrFRxyLG68shrqmZuWvGXgvbWtZBQh
 EBE8KWzyZbvhrtsLkx92k5N1GqBOUQDSLl08Rhdg/Qt0WlUHaS826XNawvnhI60t+Hy5
 AgK1ZL5qGKeFrE3N6EqIFRcgZEXGtklmQF3bSpJzSxYGltBivg2f436CZ0/1InKAl+rF
 gzczMq4UNipdCdKmh4V6xAUTE8shwA6sx1KW2RhgneZ4HT7SfS85obcUWUfV3uVvDICQ
 QR0NVos5/X2F5gzzYqgY22P/YYF+BR1MZbrVx71WDP4jT+5RqN+L9uyX4ZhP/zHOe3LV
 34gQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCWhgBUPmhjr+V4IjEDpjPU28mkP3cl/BMEoWRssz20I++DWsocsPw6PxYbgIYMRvKH0mRhu90sN/zKsj9a5TlMXqC/49zM=
X-Gm-Message-State: AOJu0YyirpUS48+CXbBDD6hplHcQFvpFZaqo9D+tp+3GdX40wU7PlNo7
 l9rr7QOTeJdv7J+aRz1kauxBXWSq+GWOP6u0oBF87bRKCXFZDBdh
X-Google-Smtp-Source: AGHT+IEt+PhydDjLXFZ13npeF1vfQrVSe2rTVHMPU4y/rDH1nWH4slEv8GghOdVSFW90AptWznuP/g==
X-Received: by 2002:a17:907:104b:b0:a72:65e5:3e7 with SMTP id
 a640c23a62f3a-a7514441510mr201068166b.55.1719757734714; 
 Sun, 30 Jun 2024 07:28:54 -0700 (PDT)
Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it.
 [2.230.139.124]) by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-a72aaf1843fsm244440666b.39.2024.06.30.07.28.54
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 30 Jun 2024 07:28:54 -0700 (PDT)
From: Vincenzo Pupillo <v.pupillo@HIDDEN>
To: Juri Linkov <juri@HIDDEN>, bug-gnu-emacs@HIDDEN
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
Date: Sun, 30 Jun 2024 16:28:53 +0200
Message-ID: <4943193.OV4Wx5bFTl@fedora>
In-Reply-To: <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN>
References: <86h6dny3om.fsf@HIDDEN>
 <E28313FF-A353-4BB5-BC06-FFD4E5F19385@HIDDEN>
 <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"
Received-SPF: pass client-ip=2a00:1450:4864:20::62b;
 envelope-from=v.pupillo@HIDDEN; helo=mail-ej1-x62b.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,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Yuan Fu <casouri@HIDDEN>, 71681 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Today I did a git pull of the master branch.
Is it possible that this patch is the cause of this error?

Error muted by safe_call: (treesit--font-lock-mark-ranges-to-fontify ((1 .=
=20
8867)) #<treesit-parser for php>) signaled (wrong-type-argument treesit-nod=
e-p=20
#<treesit-parser for php>)
Error during redisplay: (jit-lock-function 1) signaled (wrong-type-argument=
=20
treesit-node-p #<treesit-parser for php>)

Vincenzo

In data domenica 30 giugno 2024 01:54:39 CEST, Yuan Fu ha scritto:
> > On Jun 25, 2024, at 11:04=E2=80=AFPM, Yuan Fu <casouri@HIDDEN> wrote:
> >> On Jun 24, 2024, at 12:46=E2=80=AFAM, Yuan Fu <casouri@HIDDEN> wrot=
e:
> >>> On Jun 23, 2024, at 10:38=E2=80=AFAM, Juri Linkov <juri@HIDDEN> w=
rote:
> >>>>> Evaluating this expression causes a crash:
> >>>>>=20
> >>>>> (progn
> >>>>> (find-file (expand-file-name "src/treesit.c" installation-directory=
))
> >>>>> (c-ts-mode)
> >>>>> (font-lock-ensure 63209 63387))
> >>>>>=20
> >>>>> in latest master, but not in latest emacs-29 (only in 5-months old
> >>>>> emacs-29).
> >>>>>=20
> >>>>> If this is not reproducible, I could provide more details.
> >>>>>=20
> >>>>> libtree-sitter is at the latest version.
> >>>>=20
> >>>> Hmm, I can=E2=80=99t reproduce with latest master and libtree-sitter=
=2E Maybe you
> >>>> can send me the exact commits that you used?
> >>>>=20
> >>>> Here=E2=80=99s mine:
> >>>>=20
> >>>> Emacs: 72f2b01e318
> >>>> Tree-sitter: 6ec478c1
> >>>=20
> >>> Probably reproducibility depends on the content of the src/treesit.c
> >>> file.
> >>> Then the most reliable way to reproduce it is this:
> >>>=20
> >>> 0. emacs -Q
> >>> 1. eval: (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
> >>> 2. C-x v L
> >>> 3. in the *vc-change-log* buffer move point to the commit 20af58d3a13
> >>> 4. type D
> >>> 5. crash caused by diff-font-lock-syntax fontification that uses tree=
sit
> >>>=20
> >>> The numbers in (font-lock-ensure 63209 63387) above were extracted
> >>> from diff hunk boundaries that might be different when the file was
> >>> edited.
> >>=20
> >> I reproduce it once with the first set of commits you provided, but for
> >> some reason couldn=E2=80=99t reproduce it again. I=E2=80=99m sure it=
=E2=80=99s something wrong
> >> that I did. I=E2=80=99ll report back when I make progress. TBH it seem=
s like
> >> something wrong with tree-sitter itself, but I=E2=80=99ll make sure to=
 figure
> >> out what=E2=80=99s the problem exactly.
> >>=20
> >> Yuan
> >=20
> > Ok, I can reproduce it now. Looking into it=E2=80=A6
>=20
> Finally figured out why. It=E2=80=99s not tree-sitter=E2=80=99s problem, =
but ours. I reduced
> the crash to a signal and pushed the fix to emacs-30. Next I=E2=80=99ll m=
ake sure
> the signal is properly handled. Below quoting the commit message:
>=20
> The immediate cause of the crash is that tree-sitter accessed a node's
> tree, but the tree is already deleted.
>=20
> What happended, I think, is this:
>=20
> 1. Buffer modified, parser->need_reparse set to true,
> parser->timestamp incremented.
> 2. A node is created from the parser, this node has the old tree but
> the _new_ timestamp (bad!).
> 3. Parser re-parses (treesit_ensure_parsed), new tree created, old
> tree deleted.
> 4. Ftreesit_query_capture accessed the old node, and the old tree,
> crash.
>=20
> We shouldn't bump the parser timestamp when we set
> parser->need_reparse to true; instead, we should bump the timestamp
> when we actually reparsed and created a new tree.
>=20
> Yuan








Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at 71681 <at> debbugs.gnu.org:


Received: (at 71681) by debbugs.gnu.org; 29 Jun 2024 23:56:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 29 19:56:00 2024
Received: from localhost ([127.0.0.1]:54153 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sNhvE-0005wq-Bb
	for submit <at> debbugs.gnu.org; Sat, 29 Jun 2024 19:56:00 -0400
Received: from mail-oo1-f47.google.com ([209.85.161.47]:47145)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1sNhvA-0005wb-VF
 for 71681 <at> debbugs.gnu.org; Sat, 29 Jun 2024 19:55:58 -0400
Received: by mail-oo1-f47.google.com with SMTP id
 006d021491bc7-5c405dad8b6so836617eaf.2
 for <71681 <at> debbugs.gnu.org>; Sat, 29 Jun 2024 16:55:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719705291; x=1720310091; 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=kdD0Jv2bTEw+Ke3+PejQMTzqeolRrdAg250gz9l899E=;
 b=RJKoN1dxwXlnWTeVelFBIJxeZgHJWmxi9xJwknJXN1ahspDHWCJ9hi+KAn1zZcwVnp
 Tvrdbb9HFrsEBXBAf5oYHQ98XBS0D0viXkgh+WcBzKqGuIGSiMGE4YVK0eV0qlJg7n5v
 PQGN4uTjoJNwK23njy64jNfIQUvq4/XP0dEYWmmcDoVssWyklzQ5rPzqcgxvQTnCk/Js
 ODoVEiVcPx+73hJxTcsGUVLzYgTIad32jL07IvvfltUQqiC+iFMJWPrxeJP8suzuRtmO
 RqRvqgg+cB5XVtFxoYS5TOio4iS9ZGDsCOJF5aaO7ICoGqCP//SYAPKwFeVlbI658u5e
 LDSA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719705291; x=1720310091;
 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=kdD0Jv2bTEw+Ke3+PejQMTzqeolRrdAg250gz9l899E=;
 b=aWj8GqT07Y57a4GEkS8+TrGDb4yyU2yj1BK5kvoYldvRX07WiwP5wHmQpWBpZP/2/l
 XjpmMD9upgjNhQM4BNExXnjJmJNestIKveib9HIIDkeftQsEEMxWtqt74IeIA4oXYHtU
 irHebff0XzD0JiorVanVqC4IIoI8HI5A6vYeg3cbO0NPe2T2mCoLJDe8O6HwSCeoxSpW
 Uc3Q+Rd/I2M1CNwxWw8cPNXRQgfSYlnsuETVUiHTj2LHB6qfroa3Mfj3md0Hy6/DISny
 A8pJCPmy7v8ttaz8Eg0RGZaaGduWcEGq0YcjzRX1awN7gRjGi+fGD063XJkmWW1pN1FL
 CFrw==
X-Gm-Message-State: AOJu0Yy2XGUgX7Hztw/YfrMjA+XyM8Bb6uwnOfL3KFN1U9N0sxG33meX
 ASwXfLJ5iAlsqCrTyH1GG2xtDVtAn57ER+4WBoi+afS2oW/EfLJI
X-Google-Smtp-Source: AGHT+IE/FKoOMYTUKQBed6/qvPADxoAtw0Zs2dOCXUxOcZvDkuVacpwNL56NRKSz2VzxfPLVwFUqkQ==
X-Received: by 2002:a05:6870:648a:b0:25c:4d88:3d70 with SMTP id
 586e51a60fabf-25db35cda8cmr1979249fac.59.1719705291250; 
 Sat, 29 Jun 2024 16:54:51 -0700 (PDT)
Received: from smtpclient.apple ([2601:646:8f81:6120:905e:641:dacc:2f83])
 by smtp.gmail.com with ESMTPSA id
 98e67ed59e1d1-2c91ce16888sm3918798a91.2.2024.06.29.16.54.50
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 29 Jun 2024 16:54:50 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <E28313FF-A353-4BB5-BC06-FFD4E5F19385@HIDDEN>
Date: Sat, 29 Jun 2024 16:54:39 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <25A37A53-DD48-4E34-ABD7-1BACECCD8CEC@HIDDEN>
References: <86h6dny3om.fsf@HIDDEN>
 <9D0E4C93-9CCC-4C0E-BDF7-CB6F09132C23@HIDDEN>
 <86o77rpnjz.fsf@HIDDEN>
 <74F62063-1C20-4257-92BA-F2CF02B9A588@HIDDEN>
 <E28313FF-A353-4BB5-BC06-FFD4E5F19385@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
X-Mailer: Apple Mail (2.3774.600.62)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71681
Cc: 71681 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



> On Jun 25, 2024, at 11:04=E2=80=AFPM, Yuan Fu <casouri@HIDDEN> =
wrote:
>=20
>=20
>=20
>> On Jun 24, 2024, at 12:46=E2=80=AFAM, Yuan Fu <casouri@HIDDEN> =
wrote:
>>=20
>>=20
>>=20
>>> On Jun 23, 2024, at 10:38=E2=80=AFAM, Juri Linkov <juri@HIDDEN> =
wrote:
>>>=20
>>>>> Evaluating this expression causes a crash:
>>>>>=20
>>>>> (progn
>>>>> (find-file (expand-file-name "src/treesit.c" =
installation-directory))
>>>>> (c-ts-mode)
>>>>> (font-lock-ensure 63209 63387))
>>>>>=20
>>>>> in latest master, but not in latest emacs-29 (only in 5-months old =
emacs-29).
>>>>>=20
>>>>> If this is not reproducible, I could provide more details.
>>>>>=20
>>>>> libtree-sitter is at the latest version.
>>>>=20
>>>> Hmm, I can=E2=80=99t reproduce with latest master and =
libtree-sitter. Maybe you can send me the exact commits that you used?
>>>>=20
>>>> Here=E2=80=99s mine:
>>>>=20
>>>> Emacs: 72f2b01e318
>>>> Tree-sitter: 6ec478c1
>>>=20
>>> Probably reproducibility depends on the content of the src/treesit.c =
file.
>>> Then the most reliable way to reproduce it is this:
>>>=20
>>> 0. emacs -Q
>>> 1. eval: (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
>>> 2. C-x v L
>>> 3. in the *vc-change-log* buffer move point to the commit =
20af58d3a13
>>> 4. type D
>>> 5. crash caused by diff-font-lock-syntax fontification that uses =
treesit
>>>=20
>>> The numbers in (font-lock-ensure 63209 63387) above were extracted
>>> from diff hunk boundaries that might be different when the file was =
edited.
>>=20
>> I reproduce it once with the first set of commits you provided, but =
for some reason couldn=E2=80=99t reproduce it again. I=E2=80=99m sure =
it=E2=80=99s something wrong that I did. I=E2=80=99ll report back when I =
make progress. TBH it seems like something wrong with tree-sitter =
itself, but I=E2=80=99ll make sure to figure out what=E2=80=99s the =
problem exactly.
>>=20
>> Yuan
>=20
> Ok, I can reproduce it now. Looking into it=E2=80=A6

Finally figured out why. It=E2=80=99s not tree-sitter=E2=80=99s problem, =
but ours. I reduced the crash to a signal and pushed the fix to =
emacs-30. Next I=E2=80=99ll make sure the signal is properly handled. =
Below quoting the commit message:

The immediate cause of the crash is that tree-sitter accessed a node's
tree, but the tree is already deleted.

What happended, I think, is this:

1. Buffer modified, parser->need_reparse set to true,
parser->timestamp incremented.
2. A node is created from the parser, this node has the old tree but
the _new_ timestamp (bad!).
3. Parser re-parses (treesit_ensure_parsed), new tree created, old
tree deleted.
4. Ftreesit_query_capture accessed the old node, and the old tree,
crash.

We shouldn't bump the parser timestamp when we set
parser->need_reparse to true; instead, we should bump the timestamp
when we actually reparsed and created a new tree.

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at 71681 <at> debbugs.gnu.org:


Received: (at 71681) by debbugs.gnu.org; 26 Jun 2024 06:06:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 26 02:06:19 2024
Received: from localhost ([127.0.0.1]:37968 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sMLnP-0002UG-EA
	for submit <at> debbugs.gnu.org; Wed, 26 Jun 2024 02:06:19 -0400
Received: from mail-pl1-f172.google.com ([209.85.214.172]:49481)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1sMLnL-0002Tz-TZ
 for 71681 <at> debbugs.gnu.org; Wed, 26 Jun 2024 02:06:17 -0400
Received: by mail-pl1-f172.google.com with SMTP id
 d9443c01a7336-1f9cd92b146so49505845ad.3
 for <71681 <at> debbugs.gnu.org>; Tue, 25 Jun 2024 23:06:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719381908; x=1719986708; 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=50DWDFmGXKBKcOwP8suFeuPvM+pIt/nh/JnkH6mamMk=;
 b=Aw7bA9aaJAGvKpFwIgC+ZKu46xIQJ4mlUDhYvanWhmBMoZFGZIsfcPcioM4qMgAuER
 1kdHe/nb17IYRB1j57P/25Y163IRJqpCfrViNuZozKrGd6ZngNaBJ9bkeUvjTaD1aY1H
 D7zQ7DcpF//pBe38vOhMVIncGnevQu5dbSD8RGL6Gn4aCA0T0OVOxAdW7lDfd5CyrY5P
 YwzX3r6/Ag9oHKwSXeaPN9hXLP4JJiFDbty0DxyBlsBR5rT+oVG7j2CBcrszLIhhl/Su
 Vknh4NvnTHdUYzJsloQdM8kS1B1LxpzrB54ZeWDQBUVhpBojnsE20l1dHsGuhMA9skXV
 eVqg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719381908; x=1719986708;
 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=50DWDFmGXKBKcOwP8suFeuPvM+pIt/nh/JnkH6mamMk=;
 b=wmAxBWEZUeCKdnqV6bo173/focQNoFgEaYGCen5UzL7TkYm7D5WzU5f10auuzNBeCU
 sMGfPDz6wmT9YxhMkj9BgWDPkRUplX1favZxgfDv2l2TIR3Uw0UT34tkevOrgVICRY3P
 EPTCxxpGbtlGVpfGsKlSHu7FKlV554uoimYt11fF9uOOnsOow1NOmDN8cjG5t/xf1/uh
 bTItNJEC8B1Tw3LH/ggqVatlg2rVCIQIRZZiv8XYsGhQR3D0HmAXsoWDE7O+Nc+s8c7u
 sEPFxgA6l3we8XSRrAAl2pVJ57+4mTAedi0v+Du3oLmLlSHqPQRrD9wzkao8heUcI6q4
 bFWQ==
X-Gm-Message-State: AOJu0YwS8QS34kft0/GgQPhXHhc5RqJPNHvIJohV/aUZ2DgoC/DCfaCw
 WoZsRDTwRS3u1fOOJGG00Dtf/uFqHEcFkoRb+2BHMwEWcficHU3i
X-Google-Smtp-Source: AGHT+IFxWuySynEuv3r3R5TZTWPNGoUkPSVUdXyGPhG8gHgP8W4v5NbU9ppBmGR2puwtZE3i8kHqJA==
X-Received: by 2002:a17:902:f54e:b0:1fa:5fa:aaf9 with SMTP id
 d9443c01a7336-1fa1d62ba2cmr137549995ad.38.1719381907828; 
 Tue, 25 Jun 2024 23:05:07 -0700 (PDT)
Received: from smtpclient.apple ([2601:646:8f81:6120:3c6b:9027:64f0:9805])
 by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-1f9eb3c5ea7sm91234465ad.175.2024.06.25.23.05.07
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 25 Jun 2024 23:05:07 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <74F62063-1C20-4257-92BA-F2CF02B9A588@HIDDEN>
Date: Tue, 25 Jun 2024 23:04:56 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <E28313FF-A353-4BB5-BC06-FFD4E5F19385@HIDDEN>
References: <86h6dny3om.fsf@HIDDEN>
 <9D0E4C93-9CCC-4C0E-BDF7-CB6F09132C23@HIDDEN>
 <86o77rpnjz.fsf@HIDDEN>
 <74F62063-1C20-4257-92BA-F2CF02B9A588@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
X-Mailer: Apple Mail (2.3774.600.62)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71681
Cc: 71681 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



> On Jun 24, 2024, at 12:46=E2=80=AFAM, Yuan Fu <casouri@HIDDEN> =
wrote:
>=20
>=20
>=20
>> On Jun 23, 2024, at 10:38=E2=80=AFAM, Juri Linkov <juri@HIDDEN> =
wrote:
>>=20
>>>> Evaluating this expression causes a crash:
>>>>=20
>>>> (progn
>>>> (find-file (expand-file-name "src/treesit.c" =
installation-directory))
>>>> (c-ts-mode)
>>>> (font-lock-ensure 63209 63387))
>>>>=20
>>>> in latest master, but not in latest emacs-29 (only in 5-months old =
emacs-29).
>>>>=20
>>>> If this is not reproducible, I could provide more details.
>>>>=20
>>>> libtree-sitter is at the latest version.
>>>=20
>>> Hmm, I can=E2=80=99t reproduce with latest master and =
libtree-sitter. Maybe you can send me the exact commits that you used?
>>>=20
>>> Here=E2=80=99s mine:
>>>=20
>>> Emacs: 72f2b01e318
>>> Tree-sitter: 6ec478c1
>>=20
>> Probably reproducibility depends on the content of the src/treesit.c =
file.
>> Then the most reliable way to reproduce it is this:
>>=20
>> 0. emacs -Q
>> 1. eval: (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
>> 2. C-x v L
>> 3. in the *vc-change-log* buffer move point to the commit 20af58d3a13
>> 4. type D
>> 5. crash caused by diff-font-lock-syntax fontification that uses =
treesit
>>=20
>> The numbers in (font-lock-ensure 63209 63387) above were extracted
>> from diff hunk boundaries that might be different when the file was =
edited.
>=20
> I reproduce it once with the first set of commits you provided, but =
for some reason couldn=E2=80=99t reproduce it again. I=E2=80=99m sure =
it=E2=80=99s something wrong that I did. I=E2=80=99ll report back when I =
make progress. TBH it seems like something wrong with tree-sitter =
itself, but I=E2=80=99ll make sure to figure out what=E2=80=99s the =
problem exactly.
>=20
> Yuan

Ok, I can reproduce it now. Looking into it=E2=80=A6

Yuan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at 71681 <at> debbugs.gnu.org:


Received: (at 71681) by debbugs.gnu.org; 24 Jun 2024 07:47:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 24 03:47:44 2024
Received: from localhost ([127.0.0.1]:44752 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sLeQR-0002Jw-C7
	for submit <at> debbugs.gnu.org; Mon, 24 Jun 2024 03:47:43 -0400
Received: from mail-pj1-f45.google.com ([209.85.216.45]:50487)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1sLeQP-0002Jd-77
 for 71681 <at> debbugs.gnu.org; Mon, 24 Jun 2024 03:47:41 -0400
Received: by mail-pj1-f45.google.com with SMTP id
 98e67ed59e1d1-2c70c372755so3148572a91.1
 for <71681 <at> debbugs.gnu.org>; Mon, 24 Jun 2024 00:47:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719215194; x=1719819994; 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=i67PzVw+QVoxI00vrZa7NC2xx64TVdaCX21KonL0iKg=;
 b=XR32cTqfVxbTNJD9a4mINIQD9JMqi3qpa7OLVOPOr8BZd8KTd3NiYH0yQ+8LkTWZVH
 YCA4jAJ2pPM7HBkioxFfRY5RiTg7mX81lxiDeWgao44Yu8j/RJrmBH7sc1dmwNVjyleo
 Jnc+FqNR8gX/UP3geSbCezbJ/RfbKahykKKSaSB+r/W3XgjHIdF58h6hTgHCQqtZKDf6
 7Ua6N1ECHF0CjZR8H9mHYtfCKZ8KvgG0Ik5sr3SdGBjIoVwcDvL2g4liXWEN6GhpkvBe
 Z3YDK99C0u0LeQItvmv8D0AYMELOXBpa5U2u2dG1GNUH64gq+85e77qiANXrm7j66YLf
 bBDg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719215194; x=1719819994;
 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=i67PzVw+QVoxI00vrZa7NC2xx64TVdaCX21KonL0iKg=;
 b=fUNNHAAi5/FUx75VEZfhVKd/R4Kv693WW+fEpRzTozlMXdIRmrD1kT+KfwAY71ps60
 Y6RrgEhE4AjWRcZ6hyK0aFUdNl1DGczdv+2gKquEerIYIKkboP0xBIhNuyx7TNt161sL
 aoPrmQOvUdMVvz1mbwuUUYXvayxqTYtvlRkATV44hZN71yo0j071vUWQLiyiqZ3aTrLS
 Lv+k8fslmUb1r2PcXzj/7doxTyMaV0xXuUKGRf/Vx8xpSnq87f/RVOGg7qFUXF98lZwJ
 g1t44lYt2f8mmOgACmCmUq7brBbpPkHvZcEBrwYceYkpA+qjL6utBUQWcfMJv8gQQCSO
 uYag==
X-Gm-Message-State: AOJu0Yx8CTxkegrxHTIDpxh8mnWAwV1X8CnNnjHA+3SL3p88Fmt6xbe6
 2lrqlkWAgmwm01aDtymK72wdcjmb8VJ6u/ydmb6fkkcvVgbtbgqV
X-Google-Smtp-Source: AGHT+IGFAqP5Jufvw/CRf/QMBmjs8E/YTVDEytHCFgEerH+KziTohEezl9W4n96NTo7fZ7shjClY4g==
X-Received: by 2002:a17:90a:df16:b0:2c1:ebc4:4f1f with SMTP id
 98e67ed59e1d1-2c86146c874mr2245320a91.33.1719215194070; 
 Mon, 24 Jun 2024 00:46:34 -0700 (PDT)
Received: from smtpclient.apple ([2601:646:8f81:6120:20fa:247c:4f0e:e2a2])
 by smtp.gmail.com with ESMTPSA id
 98e67ed59e1d1-2c7e64a2bc8sm8078091a91.54.2024.06.24.00.46.33
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 24 Jun 2024 00:46:33 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <86o77rpnjz.fsf@HIDDEN>
Date: Mon, 24 Jun 2024 00:46:22 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <74F62063-1C20-4257-92BA-F2CF02B9A588@HIDDEN>
References: <86h6dny3om.fsf@HIDDEN>
 <9D0E4C93-9CCC-4C0E-BDF7-CB6F09132C23@HIDDEN>
 <86o77rpnjz.fsf@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
X-Mailer: Apple Mail (2.3774.600.62)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71681
Cc: 71681 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



> On Jun 23, 2024, at 10:38=E2=80=AFAM, Juri Linkov <juri@HIDDEN> =
wrote:
>=20
>>> Evaluating this expression causes a crash:
>>>=20
>>> (progn
>>> (find-file (expand-file-name "src/treesit.c" =
installation-directory))
>>> (c-ts-mode)
>>> (font-lock-ensure 63209 63387))
>>>=20
>>> in latest master, but not in latest emacs-29 (only in 5-months old =
emacs-29).
>>>=20
>>> If this is not reproducible, I could provide more details.
>>>=20
>>> libtree-sitter is at the latest version.
>>=20
>> Hmm, I can=E2=80=99t reproduce with latest master and libtree-sitter. =
Maybe you can send me the exact commits that you used?
>>=20
>> Here=E2=80=99s mine:
>>=20
>> Emacs: 72f2b01e318
>> Tree-sitter: 6ec478c1
>=20
> Probably reproducibility depends on the content of the src/treesit.c =
file.
> Then the most reliable way to reproduce it is this:
>=20
> 0. emacs -Q
> 1. eval: (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
> 2. C-x v L
> 3. in the *vc-change-log* buffer move point to the commit 20af58d3a13
> 4. type D
> 5. crash caused by diff-font-lock-syntax fontification that uses =
treesit
>=20
> The numbers in (font-lock-ensure 63209 63387) above were extracted
> from diff hunk boundaries that might be different when the file was =
edited.

I reproduce it once with the first set of commits you provided, but for =
some reason couldn=E2=80=99t reproduce it again. I=E2=80=99m sure it=E2=80=
=99s something wrong that I did. I=E2=80=99ll report back when I make =
progress. TBH it seems like something wrong with tree-sitter itself, but =
I=E2=80=99ll make sure to figure out what=E2=80=99s the problem exactly.

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at 71681 <at> debbugs.gnu.org:


Received: (at 71681) by debbugs.gnu.org; 23 Jun 2024 17:43:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 23 13:43:25 2024
Received: from localhost ([127.0.0.1]:42717 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sLRFM-0004nN-Uy
	for submit <at> debbugs.gnu.org; Sun, 23 Jun 2024 13:43:25 -0400
Received: from relay2-d.mail.gandi.net ([217.70.183.194]:56901)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1sLRFI-0004me-0s
 for 71681 <at> debbugs.gnu.org; Sun, 23 Jun 2024 13:43:20 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id C86C840003;
 Sun, 23 Jun 2024 17:43:12 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
In-Reply-To: <9D0E4C93-9CCC-4C0E-BDF7-CB6F09132C23@HIDDEN> (Yuan Fu's
 message of "Sat, 22 Jun 2024 16:55:38 -0700")
Organization: LINKOV.NET
References: <86h6dny3om.fsf@HIDDEN>
 <9D0E4C93-9CCC-4C0E-BDF7-CB6F09132C23@HIDDEN>
Date: Sun, 23 Jun 2024 20:38:08 +0300
Message-ID: <86o77rpnjz.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 71681
Cc: 71681 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> Evaluating this expression causes a crash:
>>
>> (progn
>>  (find-file (expand-file-name "src/treesit.c" installation-directory))
>>  (c-ts-mode)
>>  (font-lock-ensure 63209 63387))
>>
>> in latest master, but not in latest emacs-29 (only in 5-months old emacs-29).
>>
>> If this is not reproducible, I could provide more details.
>>
>> libtree-sitter is at the latest version.
>
> Hmm, I can’t reproduce with latest master and libtree-sitter. Maybe you can send me the exact commits that you used?
>
> Here’s mine:
>
> Emacs: 72f2b01e318
> Tree-sitter: 6ec478c1

Probably reproducibility depends on the content of the src/treesit.c file.
Then the most reliable way to reproduce it is this:

0. emacs -Q
1. eval: (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
2. C-x v L
3. in the *vc-change-log* buffer move point to the commit 20af58d3a13
4. type D
5. crash caused by diff-font-lock-syntax fontification that uses treesit

The numbers in (font-lock-ensure 63209 63387) above were extracted
from diff hunk boundaries that might be different when the file was edited.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at 71681 <at> debbugs.gnu.org:


Received: (at 71681) by debbugs.gnu.org; 23 Jun 2024 07:06:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 23 03:06:34 2024
Received: from localhost ([127.0.0.1]:47605 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sLHJ3-0004Du-W8
	for submit <at> debbugs.gnu.org; Sun, 23 Jun 2024 03:06:34 -0400
Received: from relay5-d.mail.gandi.net ([217.70.183.197]:37061)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1sLHJ1-0004Db-Kl
 for 71681 <at> debbugs.gnu.org; Sun, 23 Jun 2024 03:06:32 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 390C11C0006;
 Sun, 23 Jun 2024 07:06:03 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
In-Reply-To: <9D0E4C93-9CCC-4C0E-BDF7-CB6F09132C23@HIDDEN> (Yuan Fu's
 message of "Sat, 22 Jun 2024 16:55:38 -0700")
Organization: LINKOV.NET
References: <86h6dny3om.fsf@HIDDEN>
 <9D0E4C93-9CCC-4C0E-BDF7-CB6F09132C23@HIDDEN>
Date: Sun, 23 Jun 2024 09:46:58 +0300
Message-ID: <86pls8m9j9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 71681
Cc: 71681 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> Evaluating this expression causes a crash:
>>
>> (progn
>>  (find-file (expand-file-name "src/treesit.c" installation-directory))
>>  (c-ts-mode)
>>  (font-lock-ensure 63209 63387))
>>
>> in latest master, but not in latest emacs-29 (only in 5-months old emacs-29).
>>
>> If this is not reproducible, I could provide more details.
>>
>> libtree-sitter is at the latest version.
>
> Hmm, I can’t reproduce with latest master and libtree-sitter.
> Maybe you can send me the exact commits that you used?
>
> Here’s mine:
>
> Emacs: 72f2b01e318
> Tree-sitter: 6ec478c1

The commit are:

Emacs: 6f2036243f2 (2024-06-23, latest master)
Tree-sitter: 3da7deed (2024-06-08, version 0.22.6)

Also fails on old commits:
Emacs: ef01b634d21 (2024-01-18, emacs-29)
Tree-sitter: 870fb877 (2022-11-16, version 0.6.3)

But doesn't fail on:
Emacs: ce85d3811da (2024-06-18, recent emacs-29)
Tree-sitter: 3da7deed (2024-06-08, version 0.22.6)

Maybe it doesn't fail on recent emacs-29 because of the fix in 20af58d3a13?
But the same fix exists in latest master as well.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at 71681 <at> debbugs.gnu.org:


Received: (at 71681) by debbugs.gnu.org; 23 Jun 2024 05:33:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 23 01:33:00 2024
Received: from localhost ([127.0.0.1]:45221 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sLFqW-0006iu-3O
	for submit <at> debbugs.gnu.org; Sun, 23 Jun 2024 01:33:00 -0400
Received: from eggs.gnu.org ([209.51.188.92]:42950)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1sLFqT-0006if-PO
 for 71681 <at> debbugs.gnu.org; Sun, 23 Jun 2024 01:32:58 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1sLFqL-00073I-Tm; Sun, 23 Jun 2024 01:32:50 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=RYiqRes6ZDyWApwN5IO7/cydfVFarj5YMfMQaXqW9rA=; b=M2jx2L3LMwHdv7/KKwg0
 CGnwSCq/NSyQtNcwgEp3AICPcw63ZTy5gaTG4qtP0nDwA0GsL8Ls5ZtGy5Rt7hyc+lS7hpozpF73E
 jMjCiNtMVFRGiuddAO7lTmRiVetAUy51LD1zfdf6I0DYXKgfeEYztMt+2N/ipCvsLymM/ZRjaQtiZ
 2wn27bVAl4B8ataVx/WALiNBlJfVxa2aUbBHQO91Jj9BJCkvRQY3bq2gTaJtGvvUMprP+6YNJrNXt
 VeKhwP3OMa/dHHFBV/d/H2iWWp8/KtP/dkDvpfcDxiru2hc041J2czquHMRbNBHLRKvECXiw+Sa2q
 tRB+KTvYqJDLhg==;
Date: Sun, 23 Jun 2024 08:32:47 +0300
Message-Id: <867cegfclc.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <9D0E4C93-9CCC-4C0E-BDF7-CB6F09132C23@HIDDEN> (message from
 Yuan Fu on Sat, 22 Jun 2024 16:55:38 -0700)
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
References: <86h6dny3om.fsf@HIDDEN>
 <9D0E4C93-9CCC-4C0E-BDF7-CB6F09132C23@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 71681
Cc: 71681 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: 71681 <at> debbugs.gnu.org
> From: Yuan Fu <casouri@HIDDEN>
> Date: Sat, 22 Jun 2024 16:55:38 -0700
> 
> 
> 
> > On Jun 20, 2024, at 9:33 AM, Juri Linkov <juri@HIDDEN> wrote:
> > 
> > Evaluating this expression causes a crash:
> > 
> > (progn
> >  (find-file (expand-file-name "src/treesit.c" installation-directory))
> >  (c-ts-mode)
> >  (font-lock-ensure 63209 63387))
> > 
> > in latest master, but not in latest emacs-29 (only in 5-months old emacs-29).
> > 
> > If this is not reproducible, I could provide more details.
> > 
> > libtree-sitter is at the latest version.
> 
> Hmm, I can’t reproduce with latest master and libtree-sitter. Maybe you can send me the exact commits that you used?
> 
> Here’s mine:
> 
> Emacs: 72f2b01e318
> Tree-sitter: 6ec478c1

I can reproduce this with tree-sitter version 0.20.8.  Can you try
building Emacs with that version?  I know it's somewhat old, but given
the ABI breakage issue, I expect quite a few people avoid upgrading to
a later version (I didn't).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at 71681 <at> debbugs.gnu.org:


Received: (at 71681) by debbugs.gnu.org; 22 Jun 2024 23:56:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 22 19:56:59 2024
Received: from localhost ([127.0.0.1]:36606 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sLAbK-00018L-VO
	for submit <at> debbugs.gnu.org; Sat, 22 Jun 2024 19:56:59 -0400
Received: from mail-pf1-f175.google.com ([209.85.210.175]:50382)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1sLAbI-00017z-Aj
 for 71681 <at> debbugs.gnu.org; Sat, 22 Jun 2024 19:56:57 -0400
Received: by mail-pf1-f175.google.com with SMTP id
 d2e1a72fcca58-70667943931so606166b3a.0
 for <71681 <at> debbugs.gnu.org>; Sat, 22 Jun 2024 16:56:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719100550; x=1719705350; 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=E/xIeWELfs7Jdnjeg3+U7JMKNuyBNPgUfQnFQOyrI84=;
 b=Am/5OXF/HLdi6X0CViv4c2TUXmFMoWrJxnFALbWaCnPCERWNtNUKG4rmXGO1OwRmtX
 dAXZ7bLjoN8KPtKnZmVr4g4qq7Ut7gxMJU1c1RsJFUDWQ0ul21pcf5JxLXCaBi5XNv3H
 hYmK+LHOrl/OLbzAanUAm9Yx74nMFHDjL4ovAnqL1Qw0WDJ0W4/x+nNKmBIecRVnzwn/
 Ibgg97L6hJtyyc3VG/GzStMZnIURkeOXNROAXTZcLojpGH9grLrko9+pwD88VM3jnf9j
 UJAGPLPfJJioRSZ74yljjCsAJN8u6tjn4Uc6AhBTIW2wJNX376MGmEGY6CgTk+IGVBx6
 jq2w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719100550; x=1719705350;
 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=E/xIeWELfs7Jdnjeg3+U7JMKNuyBNPgUfQnFQOyrI84=;
 b=FqfnsnKIYwu/S1+Qcm67G1W5Z3C+qyBtzEN5g5KVLuhMJlN7kBBrp2kIXHNhXwq2lv
 1Jp5Xd5lOgvzHyhYERppURQAxLidGCtzT2Vl5fpHrF5vaPtLgtucr2FdkHLxsZnly6+N
 DNryydE35g5SSCbc+7bAvVUBzdkP5sQpMI+jUi4d+GSE2EEmcpI7TsE5PET8+KXhg3S4
 lpYLTpAET/JTdH/fL5cOQKdsHzskyHBiIr/ZRj+TKBDpquKFxRa3JV/Fn1iCnzZvJC4U
 +/dtaMY9wSkrTEtHsE+MJ6QzSRy1sygPszU03LOuq52swZ2qG3gf01m1XXlwSx2GcTcI
 fBkA==
X-Gm-Message-State: AOJu0YwpQU7HRH4Rti+E5ptnjFu7o0e0rvvN5N/BKq0umJIkJ3nhAg3x
 5FbqOP5oM7TLPzyt2WOZTYylI5EbgkIzoV0vVpOBOcmU9UbrGjej
X-Google-Smtp-Source: AGHT+IFJhS6UiN9SnLezdWObCMTNhN2GuX6kDFqTfpmTqkuUJWDbSbCgXAj0vLylm/aBxkDcIO5S1Q==
X-Received: by 2002:aa7:99dc:0:b0:706:6525:6114 with SMTP id
 d2e1a72fcca58-706746f1974mr917945b3a.25.1719100550077; 
 Sat, 22 Jun 2024 16:55:50 -0700 (PDT)
Received: from smtpclient.apple ([2601:646:8f81:6120:20fa:247c:4f0e:e2a2])
 by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-7065129bdb5sm3615614b3a.158.2024.06.22.16.55.49
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 22 Jun 2024 16:55:49 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
Subject: Re: bug#71681: 29.3.50; tree-sitter crash
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <86h6dny3om.fsf@HIDDEN>
Date: Sat, 22 Jun 2024 16:55:38 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <9D0E4C93-9CCC-4C0E-BDF7-CB6F09132C23@HIDDEN>
References: <86h6dny3om.fsf@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
X-Mailer: Apple Mail (2.3774.600.62)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71681
Cc: 71681 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



> On Jun 20, 2024, at 9:33=E2=80=AFAM, Juri Linkov <juri@HIDDEN> =
wrote:
>=20
> Evaluating this expression causes a crash:
>=20
> (progn
>  (find-file (expand-file-name "src/treesit.c" installation-directory))
>  (c-ts-mode)
>  (font-lock-ensure 63209 63387))
>=20
> in latest master, but not in latest emacs-29 (only in 5-months old =
emacs-29).
>=20
> If this is not reproducible, I could provide more details.
>=20
> libtree-sitter is at the latest version.

Hmm, I can=E2=80=99t reproduce with latest master and libtree-sitter. =
Maybe you can send me the exact commits that you used?

Here=E2=80=99s mine:

Emacs: 72f2b01e318
Tree-sitter: 6ec478c1

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 20 Jun 2024 16:42:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 20 12:42:32 2024
Received: from localhost ([127.0.0.1]:35971 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sKKro-0007Mb-0L
	for submit <at> debbugs.gnu.org; Thu, 20 Jun 2024 12:42:32 -0400
Received: from lists.gnu.org ([209.51.188.17]:43560)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1sKKrl-0007MT-TN
 for submit <at> debbugs.gnu.org; Thu, 20 Jun 2024 12:42:30 -0400
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 <juri@HIDDEN>) id 1sKKrg-0006vE-IB
 for bug-gnu-emacs@HIDDEN; Thu, 20 Jun 2024 12:42:24 -0400
Received: from relay4-d.mail.gandi.net ([2001:4b98:dc4:8::224])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1sKKrd-0006Dt-OL
 for bug-gnu-emacs@HIDDEN; Thu, 20 Jun 2024 12:42:23 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id BD8DFE0002
 for <bug-gnu-emacs@HIDDEN>; Thu, 20 Jun 2024 16:42:17 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.3.50; tree-sitter crash
Organization: LINKOV.NET
X-Debbugs-Cc: Yuan Fu <casouri@HIDDEN>
Date: Thu, 20 Jun 2024 19:33:29 +0300
Message-ID: <86h6dny3om.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: juri@HIDDEN
Received-SPF: pass client-ip=2001:4b98:dc4:8::224;
 envelope-from=juri@HIDDEN; helo=relay4-d.mail.gandi.net
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.7 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.7 (--)

Evaluating this expression causes a crash:

(progn
  (find-file (expand-file-name "src/treesit.c" installation-directory))
  (c-ts-mode)
  (font-lock-ensure 63209 63387))

in latest master, but not in latest emacs-29 (only in 5-months old emacs-29).

If this is not reproducible, I could provide more details.

libtree-sitter is at the latest version.

Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
0x00007ffff3f88f41 in ts_language_public_symbol () from /usr/local/lib/libtree-sitter.so.0
(gdb) bt
#0  0x00007ffff3f88f41 in ts_language_public_symbol () at /usr/local/lib/libtree-sitter.so.0
#1  0x00007ffff3f9fe9c in ts_query_cursor.advance () at /usr/local/lib/libtree-sitter.so.0
#2  0x00007ffff3fa117f in ts_query_cursor_next_match () at /usr/local/lib/libtree-sitter.so.0
#3  0x00005555557f0f8f in Ftreesit_query_capture (node=<optimized out>, query=<optimized out>, beg=<optimized out>, end=<optimized out>, node_only=XIL(0)) at treesit.c:3014
#4  0x00007fffec125106 in F747265657369742d2d666f6e742d6c6f636b2d666f6e746966792d726567696f6e2d31_treesit__font_lock_fontify_region_1_0 ()
#5  0x000055555575faf7 in Ffuncall (nargs=7, args=0x7fffffffcc00) at eval.c:3093
#6  0x00007fffec124e28 in F747265657369742d666f6e742d6c6f636b2d666f6e746966792d726567696f6e_treesit_font_lock_fontify_region_0 ()
#7  0x000055555575faf7 in Ffuncall (nargs=4, args=0x7fffffffccb0) at eval.c:3093
#8  0x00007fffef266534 in F666f6e742d6c6f636b2d666f6e746966792d73796e746163746963616c6c792d726567696f6e_font_lock_fontify_syntactically_region_0 ()
#9  0x000055555575faf7 in Ffuncall (nargs=4, args=0x7fffffffce10) at eval.c:3093
#10 0x00007fffef26427f in F666f6e742d6c6f636b2d64656661756c742d666f6e746966792d726567696f6e_font_lock_default_fontify_region_0 ()
#11 0x000055555575faf7 in Ffuncall (nargs=4, args=0x7fffffffceb0) at eval.c:3093
#12 0x00007fffef2630c5 in F666f6e742d6c6f636b2d666f6e746966792d726567696f6e_font_lock_fontify_region_0 ()
#13 0x00005555557a8b38 in exec_byte_code (fun=<optimized out>, args_template=<optimized out>, nargs=<optimized out>, args=<optimized out>) at lisp.h:2243
#14 0x000055555575faf7 in Ffuncall (nargs=2, args=0x7fffffffd030) at eval.c:3093
#15 0x00005555557602a0 in run_hook_wrapped_funcall (nargs=<optimized out>, args=0x7fffffffd030) at eval.c:2872
#16 0x000055555575e9fb in run_hook_with_args (nargs=2, args=0x7fffffffd030, funcall=0x555555760280 <run_hook_wrapped_funcall>) at eval.c:2953
#17 0x00007fffef236115 in F6a69742d6c6f636b2d2d72756e2d66756e6374696f6e73_jit_lock__run_functions_0 ()
#18 0x000055555575faf7 in Ffuncall (nargs=3, args=0x7fffffffd150) at eval.c:3093
#19 0x00007fffef2369e9 in F6a69742d6c6f636b2d666f6e746966792d6e6f77_jit_lock_fontify_now_0 ()
#20 0x000055555575faf7 in Ffuncall (nargs=3, args=0x7fffffffd250) at eval.c:3093
#21 0x00007fffef263482 in F666f6e742d6c6f636b2d656e73757265_font_lock_ensure_0 ()
#22 0x00005555557631da in eval_sub (form=<optimized out>) at lisp.h:2243
#23 0x0000555555763381 in Fprogn (body=<optimized out>) at eval.c:439
#24 0x0000555555763066 in eval_sub (form=<optimized out>) at lisp.h:2243
#25 0x0000555555763381 in Fprogn (body=<optimized out>) at eval.c:439
#26 0x0000555555763066 in eval_sub (form=<optimized out>) at lisp.h:2243
#27 0x0000555555764bc1 in Fprogn (body=<optimized out>) at eval.c:439
#28 Flet (args=<optimized out>) at eval.c:1109
#29 0x0000555555763066 in eval_sub (form=<optimized out>) at lisp.h:2243
#30 0x0000555555763437 in Fsetq (args=<optimized out>) at eval.c:486
#31 0x0000555555763066 in eval_sub (form=<optimized out>) at lisp.h:2243
#32 0x000055555578ce3a in readevalloop_eager_expand_eval (val=<optimized out>, macroexpand=XIL(0xadd0)) at lisp.h:1192
#33 0x0000555555794ba0 in readevalloop (readcharfun=XIL(0x7ffff02e33d5), infile0=0x0, sourcename=XIL(0), printflag=true, unibyte=<optimized out>, readfun=XIL(0x5555560bc1f5), start=make_fixnum(202), end=XIL(0x5555560bc285)) at lread.c:2538
#34 0x000055555579601a in Feval_region (start=make_fixnum(202), end=make_fixnum(328), printflag=XIL(0x30), read_function=XIL(0x5555560bc1f5)) at lisp.h:752
#35 0x00007fffefacbbf6 in F656c6973702d2d6576616c2d646566756e_elisp__eval_defun_0 ()
#36 0x000055555575faf7 in Ffuncall (nargs=1, args=0x7fffffffd9f8) at eval.c:3093
#37 0x00007fffefacbcb1 in F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_38 ()
#38 0x000055555575faf7 in Ffuncall (nargs=1, args=0x7fffffffda40) at eval.c:3093
#39 0x0000555555760f09 in call0 (fn=<optimized out>) at lisp.h:3515
#40 Fhandler_bind_1 (nargs=<optimized out>, args=0x7fffffffda90) at eval.c:1478
#41 0x00007fffefacbd7a in F6576616c2d646566756e_eval_defun_0 ()
#42 0x000055555575faf7 in Ffuncall (nargs=nargs@entry=2, args=args@entry=0x7fffffffdb58) at eval.c:3093
#43 0x000055555575b4f3 in Ffuncall_interactively (nargs=2, args=0x7fffffffdb58) at callint.c:250
#44 0x000055555575faf7 in Ffuncall (nargs=nargs@entry=3, args=args@entry=0x7fffffffdb50) at eval.c:3093
#45 0x000055555575cc53 in Fcall_interactively (function=<optimized out>, record_flag=<optimized out>, keys=<optimized out>) at callint.c:789
#46 0x00007fffef9330cd in F636f6d6d616e642d65786563757465_command_execute_0 ()
#47 0x000055555575faf7 in Ffuncall (nargs=nargs@entry=2, args=args@entry=0x7fffffffde50) at eval.c:3093
#48 0x00005555556e2247 in command_loop_1 () at lisp.h:1192
#49 0x000055555575e0d7 in internal_condition_case (bfun=bfun@entry=0x5555556e1e40 <command_loop_1>, handlers=handlers@entry=XIL(0x90), hfun=hfun@entry=0x5555556d63c0 <cmd_error>) at eval.c:1613
#50 0x00005555556ce07a in command_loop_2 (handlers=handlers@entry=XIL(0x90)) at keyboard.c:1168
#51 0x000055555575e019 in internal_catch (tag=tag@entry=XIL(0x11d30), func=func@entry=0x5555556ce050 <command_loop_2>, arg=arg@entry=XIL(0x90)) at eval.c:1292
#52 0x00005555556ce016 in command_loop () at lisp.h:1192
#53 0x00005555556d5f25 in recursive_edit_1 () at keyboard.c:754
#54 0x00005555556d62d4 in Frecursive_edit () at keyboard.c:837
#55 0x00005555555aebf4 in main (argc=<optimized out>, argv=<optimized out>) at emacs.c:2629

Lisp Backtrace:
"treesit--font-lock-fontify-region-1" (0xffffcc08)
"treesit-font-lock-fontify-region" (0xffffccb8)
"font-lock-fontify-syntactically-region" (0xffffce18)
"font-lock-default-fontify-region" (0xffffceb8)
"font-lock-fontify-region" (0xedea4040)
0x5681b288 PVEC_CLOSURE
"jit-lock--run-functions" (0xffffd158)
"jit-lock-fontify-now" (0xffffd258)
"font-lock-ensure" (0xffffd2d0)
"progn" (0xffffd3a0)
"progn" (0xffffd480)
"let" (0xffffd5d0)
"setq" (0xffffd6d0)
"elisp--eval-defun" (0xffffda00)
0xf060f638 PVEC_SUBR
"eval-defun" (0xffffdb60)
"funcall-interactively" (0xffffdb58)
"command-execute" (0xffffde58)




Acknowledgement sent to Juri Linkov <juri@HIDDEN>:
New bug report received and forwarded. Copy sent to casouri@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to casouri@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#71681; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 1 Mar 2025 02:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.