GNU bug report logs - #78938
30.1.90; Segfault when using dockerfile-ts-mode

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: Sergio Durigan Junior <sergiodj@HIDDEN>; Done: Yuan Fu <casouri@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 78938) by debbugs.gnu.org; 4 Jul 2025 07:45:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 04 03:45:53 2025
Received: from localhost ([127.0.0.1]:56433 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uXb7H-000302-Si
	for submit <at> debbugs.gnu.org; Fri, 04 Jul 2025 03:45:53 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:33274)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uXb7E-0002hQ-1C
 for 78938 <at> debbugs.gnu.org; Fri, 04 Jul 2025 03:45:49 -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 1uXb77-00022c-Nb; Fri, 04 Jul 2025 03:45:41 -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=Q8+1JnmUtPVD5qjI5L0Kf3V8ntx0kzty9Y5quhTe8sQ=; b=L5vc5svpvxmToT12KeOd
 vqaK9YAlP985O9LQxaQ5uv4J428/d0gTgYL2SzfODKs/6kw1PvcewjwmOxdSFRI/d+sNjCepUyAKr
 bnxcvjIeg8/W7O9NJF93gXMVPR98SANwVmxZXhHO8cHRHi6XNrzk5BVoARI2aueCIIQrPmFCM/CPT
 ce1B5x9Ln5C/3og0d6X02tcP9ojElNML3dgCrrr0ojj85z7roc8PVaJJFVjLwmsvGseSRIv5BMjOF
 wftBQrgLEVgI72b2Fk/hBX8v7h59AeZnG+7PUq/27rPHn8hsCao2c0mHRp5tvg3GYkJbvqhFGpZQL
 CbTPI1fgC+pzMQ==;
Date: Fri, 04 Jul 2025 10:45:02 +0300
Message-Id: <86y0t4xuv5.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <7960B894-415E-4D6F-9312-2C2577AB2F10@HIDDEN> (message from
 Yuan Fu on Thu, 3 Jul 2025 23:43:32 -0700)
Subject: Re: bug#78938: 30.1.90; Segfault when using dockerfile-ts-mode
References: <874ivvitmj.fsf@HIDDEN> <86tt3u25fm.fsf@HIDDEN>
 <877c0ox3dg.fsf@HIDDEN> <7960B894-415E-4D6F-9312-2C2577AB2F10@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: 78938
Cc: 78938 <at> debbugs.gnu.org, sergiodj@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 (---)

> From: Yuan Fu <casouri@HIDDEN>
> Date: Thu, 3 Jul 2025 23:43:32 -0700
> Cc: Eli Zaretskii <eliz@HIDDEN>,
>  78938-done <at> debbugs.gnu.org
> 
> 
> 
> > On Jul 3, 2025, at 4:26 PM, Sergio Durigan Junior <sergiodj@HIDDEN> wrote:
> > 
> > On Wednesday, July 02 2025, Eli Zaretskii wrote:
> > 
> >>> From: Sergio Durigan Junior <sergiodj@HIDDEN>
> >>> Date: Tue, 01 Jul 2025 15:44:04 -0400
> >>> 
> >>> Emacs is segfaulting when I use dockerfile-ts-mode to edit a simple
> >>> Dockerfile.
> >>> 
> >>> I was able to reproduce the problem using a pristine Emacs setup:
> >>> 
> >>> --8<---------------cut here---------------start------------->8---
> >>> $ emacs -q --init-directory ~/.emacs.d-docker-mode/ -l ~/.emacs.d-docker-mode/init.el
> >>> --8<---------------cut here---------------end--------------->8---
> >>> 
> >>> --8<---------------cut here---------------start------------->8---
> >>> (require 'package)
> >>> (add-to-list 'package-archives
> >>>      '("melpa" . "https://melpa.org/packages/"))
> >>> 
> >>> (package-initialize)
> >>> 
> >>> (use-package treesit)
> >>> 
> >>> (use-package treesit-auto
> >>>  :ensure t
> >>>  :after (treesit)
> >>>  :config
> >>>  (global-treesit-auto-mode)
> >>>  (setq treesit-auto-install 'prompt))
> >>> --8<---------------cut here---------------end--------------->8---
> >>> 
> >>> Once inside Emacs, open a file named /tmp/Dockerfile (for example),
> >>> execute "M-x d-ts" to enable dockerfile-ts-mode, then write:
> >>> 
> >>> --8<---------------cut here---------------start------------->8---
> >>> RUN aaaa; \
> >>> --8<---------------cut here---------------end--------------->8---
> >>> 
> >>> and hit RET at the end of the line.
> >> 
> >> I didn't get any segfaults with this recipe, but maybe it's because I
> >> have a different version of the dockerfile grammar library and/or of
> >> the tree-sitter library?
> > 
> > Huh.  That's strange.  If you followed the recipe above, you should have
> > installed the same grammar version as I'm using.  So it might indeed be
> > the tree-sitter library.  I'm using Debian testing, and here's the
> > library version I have:
> > 
> > libtree-sitter0.22/testing,unstable,now 0.22.6-6+b1 amd64 [installed,automatic]
> > 
> >> (I also used a simplified recipe: I didn't treesit-auto and didn't
> >> activate global-treesit-auto-mode, and didn't use use-package;
> >> instead, I invoked dockerfile-ts-mode manually.  I don't think these
> >> differences should matter, though.)
> > 
> > I think using treesit-auto might influence the grammar version you have
> > installed, because it will make sure to get the latest one.
> > 
> >> The segfault you report is here:
> >> 
> >>  DEFUN ("treesit-node-type",
> >>  Ftreesit_node_type, Streesit_node_type, 1, 1, 0,
> >>  doc: /* Return the NODE's type as a string.
> >>  If NODE is nil, return nil.  */)
> >>    (Lisp_Object node)
> >>  {
> >>    if (NILP (node)) return Qnil;
> >>    treesit_check_node (node);
> >>    treesit_initialize ();
> >> 
> >>    TSNode treesit_node = XTS_NODE (node)->node;
> >>    const char *type = ts_node_type (treesit_node);
> >>    return build_string (type);  <<<<<<<<<<<<<<<<<<<<<<<<<<
> >>  }
> > 
> > Yes.
> > 
> >> and I note that we call build_string without testing the validity of
> >> the string pointed by 'type', which in this case is a NULL pointer.
> >> 
> >> Yuan, would it be okay to install the following band-aid on the
> >> emacs-30 release branch?
> >> 
> >>    if (type)
> >>      return build_string (type);
> >>    return Qnil;
> >> 
> >> This assumes that getting NULL from ts_node_type should be expected.
> >> (If it indeed should be expected, would you please review the other
> >> two places in treesit.c where we call ts_node_type?)
> > 
> > I wasn't sure whether ts_node_type could return NULL.  But upon looking
> > at the code, I see that it can:
> > 
> > const char *ts_node_type(TSNode self) {
> >  TSSymbol symbol = ts_node__alias(&self);
> >  if (!symbol) symbol = ts_subtree_symbol(ts_node__subtree(self));
> >  return ts_language_symbol_name(self.tree->language, symbol);
> > }
> > 
> > ... and ts_language_symbol_name is defined as:
> > 
> > const char *ts_language_symbol_name(
> >  const TSLanguage *self,
> >  TSSymbol symbol
> > ) {
> >  if (symbol == ts_builtin_sym_error) {
> >    return "ERROR";
> >  } else if (symbol == ts_builtin_sym_error_repeat) {
> >    return "_ERROR";
> >  } else if (symbol < ts_language_symbol_count(self)) {
> >    return self->symbol_names[symbol];
> >  } else {
> >    return NULL;
> >  }
> > }
> 
> Well, apparently this is a big lie:
> 
> /**
>  * Get the node's type as a null-terminated string.
>  */
> const char *ts_node_type(TSNode self);
> 
> Thanks for digging into this!
> 
> The NULL case is probably because something unexpected happened in tree-sitter, let’s return an empty string in Lisp since callers doesn’t expect treesit-node-type to return nil when NODE isn’t nil. I applied the patch to emacs-30.

Thanks, but we call ts_node_type in two more places.  Could you please
review them as well, and fix as necessary?




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

Message received at 78938-done <at> debbugs.gnu.org:


Received: (at 78938-done) by debbugs.gnu.org; 4 Jul 2025 06:43:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 04 02:43:54 2025
Received: from localhost ([127.0.0.1]:56185 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uXa9K-0001u6-3P
	for submit <at> debbugs.gnu.org; Fri, 04 Jul 2025 02:43:54 -0400
Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:55386)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1uXa9H-0001tk-6Z
 for 78938-done <at> debbugs.gnu.org; Fri, 04 Jul 2025 02:43:52 -0400
Received: by mail-pf1-x431.google.com with SMTP id
 d2e1a72fcca58-7399a2dc13fso864065b3a.2
 for <78938-done <at> debbugs.gnu.org>; Thu, 03 Jul 2025 23:43:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1751611425; x=1752216225; 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=wDbQmNNJfAaAJ3VaIoRb3QO71QePYtoZmxsCybHTyvw=;
 b=VHSbEnkpV1tiW0tA8lc6vyh9HLy67PpI+khXf/GUcel01PxtiZLKvhg7hJ2PkqE932
 cebUv57L9eBlhtutdtCu5k7xVOh09IGrVbIXsPyzpK9HS9u6e1O1tVVtCTEO/TYgjRHI
 TppzDcDVC9xauipaL9bIoI9cDoRBusyA2JoV6vYFgzWNWKkFXJ2XYwnlc4A3K7w3YWgd
 wVYlVrx9zL1gYdibTGrWXjwNwOXE87Ezrt5WZttAeqP975KiRoAy7iMZqgV4A2sHfy/N
 xlUJ7co3ayC0tmXmyKc8VWFWvHyrtr3icLzeX10ewicUaI8xaqYUJYAa6E9EmCKlg7j2
 atyg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1751611425; x=1752216225;
 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=wDbQmNNJfAaAJ3VaIoRb3QO71QePYtoZmxsCybHTyvw=;
 b=hMxpxVMPL9rAdEsqKYI6wXDI8SES5rGGy27Bt9eKfHHaY7y5ffNeItxh2ZGhbMXT1t
 0CBOCgIIVZKDPZ4i9NtGjmhTIOItyROhJMaevt6xNO1sjMYnxmAoCuDP9WKeDU1B2Tc3
 SpcKg07tTUS+0GCn0YAm1Odzinozf4a5XWzjv/Qb8uJEN0VNnGPq8hNN/fBW0Pl9+TJG
 Zv58H7A5mekMJOQrWhZkuqrm+CY97vEbFONsJ/CB6uEDLmX3/fjOCQXNUrIrxcLeiPY9
 /DTtAKSO3zx8xBIjDM/DtHweSxPb26iBinEttaFIcP0gIJnLy6RvBdPiEn5y5vs3f6hq
 dQ4g==
X-Forwarded-Encrypted: i=1;
 AJvYcCUUbBHtpg31ZnzRCPAq+4e0qm799m+CkJ/0jhLB9zl2S/HF6JKcaYth5f5NKECO4BScWN8wuroBZ7Ul <at> debbugs.gnu.org
X-Gm-Message-State: AOJu0YxxGrRWMyYHHroHH4QbPe83/NSmWaKCYpbHzVo4/4bYWrcR7Cqv
 X9h+F22hL4aCRlvIOPlRVM/xBbVJkmU7ocTcdEX2X0OwvXX1om5JN0gw
X-Gm-Gg: ASbGncvsV8sSkObijr5dy8UbhmTuy8ZWxVyPN3QnzPvYnSmn8hFRNu5SQxmOZrAS1XJ
 YcltilRUPV6f/vJWDxj7MsnlQF9AJIamPJ0n9YSRXTE/AlZ2BP/5JJpI4nIkS4sP8jd/835b6at
 tFWDOKwHMReR8N82MgK4s9sk62fNaxFHBSnKilOw12MXCTh6iVaebKyxG3dg66huRKSCpVtcCPJ
 8WaDP1kZUl84Opu2dBzO2JtmrmxJqcOquRq23mJibrefeodjZYMzB3Ej0FYU6iBszqTTBpYej+2
 UCzo1UzkWB8df4eO66zi0qOc4z+N8E1eT6JPuFCXDYw0j8aCBUXzFM87vnDLkcq57rIcPOvGce2
 /Kgy1VC8NQsSaDG6hTdUFx1fnBWU9zsRIi+N2rZlyPKV94g==
X-Google-Smtp-Source: AGHT+IFMnvvMGY4EBRmUKX3EV2wvkZe6jZPdvCjKMJhRC4JZp3d7sxzETXa1banVu1ho5SCwSkMO0w==
X-Received: by 2002:a05:6a20:258e:b0:1f5:8a1d:3904 with SMTP id
 adf61e73a8af0-225b7f19802mr3219755637.7.1751611424716; 
 Thu, 03 Jul 2025 23:43:44 -0700 (PDT)
Received: from smtpclient.apple (c-24-4-247-194.hsd1.ca.comcast.net.
 [24.4.247.194]) by smtp.gmail.com with ESMTPSA id
 41be03b00d2f7-b38ee5f4033sm1221084a12.47.2025.07.03.23.43.43
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 03 Jul 2025 23:43:44 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.500.181.1.5\))
Subject: Re: bug#78938: 30.1.90; Segfault when using dockerfile-ts-mode
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <877c0ox3dg.fsf@HIDDEN>
Date: Thu, 3 Jul 2025 23:43:32 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <7960B894-415E-4D6F-9312-2C2577AB2F10@HIDDEN>
References: <874ivvitmj.fsf@HIDDEN> <86tt3u25fm.fsf@HIDDEN>
 <877c0ox3dg.fsf@HIDDEN>
To: Sergio Durigan Junior <sergiodj@HIDDEN>
X-Mailer: Apple Mail (2.3826.500.181.1.5)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78938-done
Cc: Eli Zaretskii <eliz@HIDDEN>, 78938-done <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 Jul 3, 2025, at 4:26=E2=80=AFPM, Sergio Durigan Junior =
<sergiodj@HIDDEN> wrote:
>=20
> On Wednesday, July 02 2025, Eli Zaretskii wrote:
>=20
>>> From: Sergio Durigan Junior <sergiodj@HIDDEN>
>>> Date: Tue, 01 Jul 2025 15:44:04 -0400
>>>=20
>>> Emacs is segfaulting when I use dockerfile-ts-mode to edit a simple
>>> Dockerfile.
>>>=20
>>> I was able to reproduce the problem using a pristine Emacs setup:
>>>=20
>>> --8<---------------cut here---------------start------------->8---
>>> $ emacs -q --init-directory ~/.emacs.d-docker-mode/ -l =
~/.emacs.d-docker-mode/init.el
>>> --8<---------------cut here---------------end--------------->8---
>>>=20
>>> --8<---------------cut here---------------start------------->8---
>>> (require 'package)
>>> (add-to-list 'package-archives
>>>      '("melpa" . "https://melpa.org/packages/"))
>>>=20
>>> (package-initialize)
>>>=20
>>> (use-package treesit)
>>>=20
>>> (use-package treesit-auto
>>>  :ensure t
>>>  :after (treesit)
>>>  :config
>>>  (global-treesit-auto-mode)
>>>  (setq treesit-auto-install 'prompt))
>>> --8<---------------cut here---------------end--------------->8---
>>>=20
>>> Once inside Emacs, open a file named /tmp/Dockerfile (for example),
>>> execute "M-x d-ts" to enable dockerfile-ts-mode, then write:
>>>=20
>>> --8<---------------cut here---------------start------------->8---
>>> RUN aaaa; \
>>> --8<---------------cut here---------------end--------------->8---
>>>=20
>>> and hit RET at the end of the line.
>>=20
>> I didn't get any segfaults with this recipe, but maybe it's because I
>> have a different version of the dockerfile grammar library and/or of
>> the tree-sitter library?
>=20
> Huh.  That's strange.  If you followed the recipe above, you should =
have
> installed the same grammar version as I'm using.  So it might indeed =
be
> the tree-sitter library.  I'm using Debian testing, and here's the
> library version I have:
>=20
> libtree-sitter0.22/testing,unstable,now 0.22.6-6+b1 amd64 =
[installed,automatic]
>=20
>> (I also used a simplified recipe: I didn't treesit-auto and didn't
>> activate global-treesit-auto-mode, and didn't use use-package;
>> instead, I invoked dockerfile-ts-mode manually.  I don't think these
>> differences should matter, though.)
>=20
> I think using treesit-auto might influence the grammar version you =
have
> installed, because it will make sure to get the latest one.
>=20
>> The segfault you report is here:
>>=20
>>  DEFUN ("treesit-node-type",
>>  Ftreesit_node_type, Streesit_node_type, 1, 1, 0,
>>  doc: /* Return the NODE's type as a string.
>>  If NODE is nil, return nil.  */)
>>    (Lisp_Object node)
>>  {
>>    if (NILP (node)) return Qnil;
>>    treesit_check_node (node);
>>    treesit_initialize ();
>>=20
>>    TSNode treesit_node =3D XTS_NODE (node)->node;
>>    const char *type =3D ts_node_type (treesit_node);
>>    return build_string (type);  <<<<<<<<<<<<<<<<<<<<<<<<<<
>>  }
>=20
> Yes.
>=20
>> and I note that we call build_string without testing the validity of
>> the string pointed by 'type', which in this case is a NULL pointer.
>>=20
>> Yuan, would it be okay to install the following band-aid on the
>> emacs-30 release branch?
>>=20
>>    if (type)
>>      return build_string (type);
>>    return Qnil;
>>=20
>> This assumes that getting NULL from ts_node_type should be expected.
>> (If it indeed should be expected, would you please review the other
>> two places in treesit.c where we call ts_node_type?)
>=20
> I wasn't sure whether ts_node_type could return NULL.  But upon =
looking
> at the code, I see that it can:
>=20
> const char *ts_node_type(TSNode self) {
>  TSSymbol symbol =3D ts_node__alias(&self);
>  if (!symbol) symbol =3D ts_subtree_symbol(ts_node__subtree(self));
>  return ts_language_symbol_name(self.tree->language, symbol);
> }
>=20
> ... and ts_language_symbol_name is defined as:
>=20
> const char *ts_language_symbol_name(
>  const TSLanguage *self,
>  TSSymbol symbol
> ) {
>  if (symbol =3D=3D ts_builtin_sym_error) {
>    return "ERROR";
>  } else if (symbol =3D=3D ts_builtin_sym_error_repeat) {
>    return "_ERROR";
>  } else if (symbol < ts_language_symbol_count(self)) {
>    return self->symbol_names[symbol];
>  } else {
>    return NULL;
>  }
> }

Well, apparently this is a big lie:

/**
 * Get the node's type as a null-terminated string.
 */
const char *ts_node_type(TSNode self);

Thanks for digging into this!

The NULL case is probably because something unexpected happened in =
tree-sitter, let=E2=80=99s return an empty string in Lisp since callers =
doesn=E2=80=99t expect treesit-node-type to return nil when NODE isn=E2=80=
=99t nil. I applied the patch to emacs-30.

Yuan=




Notification sent to Sergio Durigan Junior <sergiodj@HIDDEN>:
bug acknowledged by developer. Full text available.
Reply sent to Yuan Fu <casouri@HIDDEN>:
You have taken responsibility. Full text available.

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


Received: (at 78938) by debbugs.gnu.org; 3 Jul 2025 23:26:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 03 19:26:51 2025
Received: from localhost ([127.0.0.1]:53562 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uXTKK-0000dq-4d
	for submit <at> debbugs.gnu.org; Thu, 03 Jul 2025 19:26:49 -0400
Received: from mail.sergiodj.net ([2a01:4f8:13a:6e8:160::1]:51014)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sergiodj@HIDDEN>)
 id 1uXTKG-0000cA-1T
 for 78938 <at> debbugs.gnu.org; Thu, 03 Jul 2025 19:26:45 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sergiodj.net;
 s=20160602; t=1751585197;
 bh=jFOCeapH+jlKI44zC+Wm6J9psVQhKwgfkhurzmVvoX8=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=1/g+7CZRVdym3fUbc+UnrL1FL3xaAZN3/cbWB1LqTVHT5vJFwNrdsdUkqneTXqZfA
 hHFa6qkA4Mj+NURN3dklxLQF5W6FQI4FVCuH4TbAErVlfP0qtCw8AZyufRafxfnioc
 NgVWWBlj4u2tvU09mVcWW4b0fzvj0wgxpRUFL5cI=
Received: from localhost (unknown
 [IPv6:2607:f2c0:edc1:fc00:f507:7cb:c287:b1ac])
 by mail.sergiodj.net (Postfix) with UTF8SMTPSA id E4751A60B64;
 Thu,  3 Jul 2025 19:26:36 -0400 (EDT)
From: Sergio Durigan Junior <sergiodj@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#78938: 30.1.90; Segfault when using dockerfile-ts-mode
In-Reply-To: <86tt3u25fm.fsf@HIDDEN> (Eli Zaretskii's message of "Wed, 02 Jul
 2025 14:33:17 +0300")
References: <874ivvitmj.fsf@HIDDEN> <86tt3u25fm.fsf@HIDDEN>
X-URL: http://blog.sergiodj.net
Date: Thu, 03 Jul 2025 19:26:35 -0400
Message-ID: <877c0ox3dg.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78938
Cc: Yuan Fu <casouri@HIDDEN>, 78938 <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 Wednesday, July 02 2025, Eli Zaretskii wrote:

>> From: Sergio Durigan Junior <sergiodj@HIDDEN>
>> Date: Tue, 01 Jul 2025 15:44:04 -0400
>> 
>> Emacs is segfaulting when I use dockerfile-ts-mode to edit a simple
>> Dockerfile.
>> 
>> I was able to reproduce the problem using a pristine Emacs setup:
>> 
>> --8<---------------cut here---------------start------------->8---
>> $ emacs -q --init-directory ~/.emacs.d-docker-mode/ -l ~/.emacs.d-docker-mode/init.el
>> --8<---------------cut here---------------end--------------->8---
>> 
>> --8<---------------cut here---------------start------------->8---
>> (require 'package)
>> (add-to-list 'package-archives
>> 	     '("melpa" . "https://melpa.org/packages/"))
>> 
>> (package-initialize)
>> 
>> (use-package treesit)
>> 
>> (use-package treesit-auto
>>   :ensure t
>>   :after (treesit)
>>   :config
>>   (global-treesit-auto-mode)
>>   (setq treesit-auto-install 'prompt))
>> --8<---------------cut here---------------end--------------->8---
>> 
>> Once inside Emacs, open a file named /tmp/Dockerfile (for example),
>> execute "M-x d-ts" to enable dockerfile-ts-mode, then write:
>> 
>> --8<---------------cut here---------------start------------->8---
>> RUN aaaa; \
>> --8<---------------cut here---------------end--------------->8---
>> 
>> and hit RET at the end of the line.
>
> I didn't get any segfaults with this recipe, but maybe it's because I
> have a different version of the dockerfile grammar library and/or of
> the tree-sitter library?

Huh.  That's strange.  If you followed the recipe above, you should have
installed the same grammar version as I'm using.  So it might indeed be
the tree-sitter library.  I'm using Debian testing, and here's the
library version I have:

libtree-sitter0.22/testing,unstable,now 0.22.6-6+b1 amd64 [installed,automatic]

> (I also used a simplified recipe: I didn't treesit-auto and didn't
> activate global-treesit-auto-mode, and didn't use use-package;
> instead, I invoked dockerfile-ts-mode manually.  I don't think these
> differences should matter, though.)

I think using treesit-auto might influence the grammar version you have
installed, because it will make sure to get the latest one.

> The segfault you report is here:
>
>   DEFUN ("treesit-node-type",
> 	 Ftreesit_node_type, Streesit_node_type, 1, 1, 0,
> 	 doc: /* Return the NODE's type as a string.
>   If NODE is nil, return nil.  */)
>     (Lisp_Object node)
>   {
>     if (NILP (node)) return Qnil;
>     treesit_check_node (node);
>     treesit_initialize ();
>
>     TSNode treesit_node = XTS_NODE (node)->node;
>     const char *type = ts_node_type (treesit_node);
>     return build_string (type);  <<<<<<<<<<<<<<<<<<<<<<<<<<
>   }

Yes.

> and I note that we call build_string without testing the validity of
> the string pointed by 'type', which in this case is a NULL pointer.
>
> Yuan, would it be okay to install the following band-aid on the
> emacs-30 release branch?
>
>     if (type)
>       return build_string (type);
>     return Qnil;
>
> This assumes that getting NULL from ts_node_type should be expected.
> (If it indeed should be expected, would you please review the other
> two places in treesit.c where we call ts_node_type?)

I wasn't sure whether ts_node_type could return NULL.  But upon looking
at the code, I see that it can:

const char *ts_node_type(TSNode self) {
  TSSymbol symbol = ts_node__alias(&self);
  if (!symbol) symbol = ts_subtree_symbol(ts_node__subtree(self));
  return ts_language_symbol_name(self.tree->language, symbol);
}

... and ts_language_symbol_name is defined as:

const char *ts_language_symbol_name(
  const TSLanguage *self,
  TSSymbol symbol
) {
  if (symbol == ts_builtin_sym_error) {
    return "ERROR";
  } else if (symbol == ts_builtin_sym_error_repeat) {
    return "_ERROR";
  } else if (symbol < ts_language_symbol_count(self)) {
    return self->symbol_names[symbol];
  } else {
    return NULL;
  }
}

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
https://sergiodj.net/




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

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


Received: (at 78938) by debbugs.gnu.org; 2 Jul 2025 11:33:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 02 07:33:35 2025
Received: from localhost ([127.0.0.1]:35950 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uWviY-00046k-QN
	for submit <at> debbugs.gnu.org; Wed, 02 Jul 2025 07:33:35 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:46936)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uWviT-00045P-K5
 for 78938 <at> debbugs.gnu.org; Wed, 02 Jul 2025 07:33:31 -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 1uWviM-0005YO-Hu; Wed, 02 Jul 2025 07:33:22 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=d3RrwiibL+VFqb3PcXbWGOckz2LTCN4vn8RD1EfDM/c=; b=JihFciXdjbMh
 yXTnjmzk2jUYZ0hEZM9hAmqbWwZLyjr3S31QvBdib+W2LACrYch8a2wyvnWenKYXpg6hzhjXEGnHk
 SQbK5eZ8lw36LIswIPon+DucjAbdL/r6Wl1zmEuvzSNOILJFBg8b33eFKxrXjl7Ht6woXRqxvm8Ta
 NfAnmxKZYUPYxQm8m9Yj+8nrPmG9WXM60dm8R9dDxaFTj6VXShRg9vrcfXCFmnZRTW/YMZ6MkszHz
 toj4y1SipaC/H0Pl6BDsrJc/hjQBRUAo3YEOiUNDQ3Vsb65sY8Zj06LmBID/SsFn89Z3aqVihKZx9
 S/B7Mdt3vvOlI00Shwep5A==;
Date: Wed, 02 Jul 2025 14:33:17 +0300
Message-Id: <86tt3u25fm.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Sergio Durigan Junior <sergiodj@HIDDEN>, Yuan Fu <casouri@HIDDEN>
In-Reply-To: <874ivvitmj.fsf@HIDDEN> (message from Sergio Durigan Junior
 on Tue, 01 Jul 2025 15:44:04 -0400)
Subject: Re: bug#78938: 30.1.90; Segfault when using dockerfile-ts-mode
References: <874ivvitmj.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78938
Cc: 78938 <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: -3.3 (---)

> From: Sergio Durigan Junior <sergiodj@HIDDEN>
> Date: Tue, 01 Jul 2025 15:44:04 -0400
> 
> Emacs is segfaulting when I use dockerfile-ts-mode to edit a simple
> Dockerfile.
> 
> I was able to reproduce the problem using a pristine Emacs setup:
> 
> --8<---------------cut here---------------start------------->8---
> $ emacs -q --init-directory ~/.emacs.d-docker-mode/ -l ~/.emacs.d-docker-mode/init.el
> --8<---------------cut here---------------end--------------->8---
> 
> --8<---------------cut here---------------start------------->8---
> (require 'package)
> (add-to-list 'package-archives
> 	     '("melpa" . "https://melpa.org/packages/"))
> 
> (package-initialize)
> 
> (use-package treesit)
> 
> (use-package treesit-auto
>   :ensure t
>   :after (treesit)
>   :config
>   (global-treesit-auto-mode)
>   (setq treesit-auto-install 'prompt))
> --8<---------------cut here---------------end--------------->8---
> 
> Once inside Emacs, open a file named /tmp/Dockerfile (for example),
> execute "M-x d-ts" to enable dockerfile-ts-mode, then write:
> 
> --8<---------------cut here---------------start------------->8---
> RUN aaaa; \
> --8<---------------cut here---------------end--------------->8---
> 
> and hit RET at the end of the line.

I didn't get any segfaults with this recipe, but maybe it's because I
have a different version of the dockerfile grammar library and/or of
the tree-sitter library?

(I also used a simplified recipe: I didn't treesit-auto and didn't
activate global-treesit-auto-mode, and didn't use use-package;
instead, I invoked dockerfile-ts-mode manually.  I don't think these
differences should matter, though.)

The segfault you report is here:

  DEFUN ("treesit-node-type",
	 Ftreesit_node_type, Streesit_node_type, 1, 1, 0,
	 doc: /* Return the NODE's type as a string.
  If NODE is nil, return nil.  */)
    (Lisp_Object node)
  {
    if (NILP (node)) return Qnil;
    treesit_check_node (node);
    treesit_initialize ();

    TSNode treesit_node = XTS_NODE (node)->node;
    const char *type = ts_node_type (treesit_node);
    return build_string (type);  <<<<<<<<<<<<<<<<<<<<<<<<<<
  }

and I note that we call build_string without testing the validity of
the string pointed by 'type', which in this case is a NULL pointer.

Yuan, would it be okay to install the following band-aid on the
emacs-30 release branch?

    if (type)
      return build_string (type);
    return Qnil;

This assumes that getting NULL from ts_node_type should be expected.
(If it indeed should be expected, would you please review the other
two places in treesit.c where we call ts_node_type?)




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

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


Received: (at submit) by debbugs.gnu.org; 1 Jul 2025 19:44:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 01 15:44:28 2025
Received: from localhost ([127.0.0.1]:58810 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uWgu2-0008VS-QD
	for submit <at> debbugs.gnu.org; Tue, 01 Jul 2025 15:44:28 -0400
Received: from lists.gnu.org ([2001:470:142::17]:37666)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sergiodj@HIDDEN>)
 id 1uWgtz-0008U9-Mn
 for submit <at> debbugs.gnu.org; Tue, 01 Jul 2025 15:44:24 -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 <sergiodj@HIDDEN>)
 id 1uWgtr-0006pR-Fw
 for bug-gnu-emacs@HIDDEN; Tue, 01 Jul 2025 15:44:15 -0400
Received: from mail.sergiodj.net ([2a01:4f8:13a:6e8:160::1])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <sergiodj@HIDDEN>)
 id 1uWgto-0003jp-8N
 for bug-gnu-emacs@HIDDEN; Tue, 01 Jul 2025 15:44:15 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sergiodj.net;
 s=20160602; t=1751399046;
 bh=4KzUTga2ob51JjG70RG+7+CX3OhPrIzMbdwwn7WhUD8=;
 h=From:To:Subject:Date:From;
 b=wih1cM0RRBEeI3IrIRHYbz5pHxFdhLdMECvGFrj7LFCFlCgnCk5URxWZZ7+zUUBhB
 GRm1oUZQtMXWabbgwpUIBl2AMpMZsabO+vELlEFllietyej8py5QnvBA1CDu9DfB2J
 woEzTD8yF54nywhRZVVkHd5oka8wh5R50mdsOOr8=
Received: from localhost (unknown
 [IPv6:2607:f2c0:edc1:fc00:22cb:1cca:2dfd:5fb1])
 by mail.sergiodj.net (Postfix) with UTF8SMTPSA id 84FA0A7356E
 for <bug-gnu-emacs@HIDDEN>; Tue,  1 Jul 2025 15:44:06 -0400 (EDT)
From: Sergio Durigan Junior <sergiodj@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.1.90; Segfault when using dockerfile-ts-mode
X-URL: http://blog.sergiodj.net
Date: Tue, 01 Jul 2025 15:44:04 -0400
Message-ID: <874ivvitmj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2a01:4f8:13a:6e8:160::1;
 envelope-from=sergiodj@HIDDEN; helo=mail.sergiodj.net
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, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
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: -0.1 (/)

Emacs is segfaulting when I use dockerfile-ts-mode to edit a simple
Dockerfile.

I was able to reproduce the problem using a pristine Emacs setup:

--8<---------------cut here---------------start------------->8---
$ emacs -q --init-directory ~/.emacs.d-docker-mode/ -l ~/.emacs.d-docker-mode/init.el
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
(require 'package)
(add-to-list 'package-archives
	     '("melpa" . "https://melpa.org/packages/"))

(package-initialize)

(use-package treesit)

(use-package treesit-auto
  :ensure t
  :after (treesit)
  :config
  (global-treesit-auto-mode)
  (setq treesit-auto-install 'prompt))
--8<---------------cut here---------------end--------------->8---

Once inside Emacs, open a file named /tmp/Dockerfile (for example),
execute "M-x d-ts" to enable dockerfile-ts-mode, then write:

--8<---------------cut here---------------start------------->8---
RUN aaaa; \
--8<---------------cut here---------------end--------------->8---

and hit RET at the end of the line.


Here's the full backtrace (with optimizations):

--8<---------------cut here---------------start------------->8---
#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
#1  0x00005555557f16ea in build_string (str=0x0) at /home/sergio/programs/emacs/emacs/src/lisp.h:4629
#2  Ftreesit_node_type (node=<optimized out>) at treesit.c:2046
        treesit_node = {context = {640, 0, 3, 0}, id = 0x280, tree = 0x7fffffffca98}
        type = 0x0
#3  0x00007fffec78f114 in F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_0 () at /home/sergio/.emacs.d-docker-mode/eln-cache/30.1.90-a95199b5/dockerfile-ts-mode-2cc274e0-bafc1340.eln
#4  0x00005555557682e6 in Ffuncall (nargs=nargs@entry=4, args=0x7fffffffca90) at eval.c:3093
        count = {bytes = <optimized out>}
        val = <optimized out>
#5  0x0000555555768660 in Fapply (nargs=2, args=0x7fffffffcb40) at eval.c:2765
        i = <optimized out>
        funcall_nargs = 4
        funcall_args = <optimized out>
        spread_arg = <optimized out>
        fun = <optimized out>
        sa_avail = <optimized out>
        sa_count = {bytes = 640}
        numargs = <optimized out>
        retval = <optimized out>
#6  0x00007fffde2f3242 in F747265657369742d2d73696d706c652d696e64656e742d6576616c_treesit__simple_indent_eval_0 () at /home/sergio/.emacs.d-docker-mode/eln-cache/30.1.90-a95199b5/treesit-37439c61-a1bf6a97.eln
#7  0x00005555557682e6 in Ffuncall (nargs=2, args=0x7fffffffcc20) at eval.c:3093
        count = {bytes = <optimized out>}
        val = <optimized out>
#8  0x00007fffde2f455b in F747265657369742d73696d706c652d696e64656e74_treesit_simple_indent_0 () at /home/sergio/.emacs.d-docker-mode/eln-cache/30.1.90-a95199b5/treesit-37439c61-a1bf6a97.eln
#9  0x00005555557682e6 in Ffuncall (nargs=4, args=0x7fffffffce10) at eval.c:3093
        count = {bytes = <optimized out>}
        val = <optimized out>
#10 0x00007fffde2f34b6 in F747265657369742d2d696e64656e742d31_treesit__indent_1_0 () at /home/sergio/.emacs.d-docker-mode/eln-cache/30.1.90-a95199b5/treesit-37439c61-a1bf6a97.eln
#11 0x00005555557682e6 in Ffuncall (nargs=1, args=0x7fffffffce98) at eval.c:3093
        count = {bytes = <optimized out>}
        val = <optimized out>
#12 0x00007fffde2f376e in F747265657369742d696e64656e74_treesit_indent_0 () at /home/sergio/.emacs.d-docker-mode/eln-cache/30.1.90-a95199b5/treesit-37439c61-a1bf6a97.eln
#13 0x00005555557682e6 in Ffuncall (nargs=1, args=0x7fffffffcf88) at eval.c:3093
        count = {bytes = <optimized out>}
        val = <optimized out>
#14 0x00007fffeffc540f in F696e64656e742d6163636f7264696e672d746f2d6d6f6465_indent_according_to_mode_0 () at /home/sergio/programs/emacs/install/bin/../lib/emacs/30.1.90/native-lisp/30.1.90-a95199b5/preloaded/indent-396b3792-a4a601d1.eln
#15 0x00005555557682e6 in Ffuncall (nargs=1, args=0x7fffffffd058) at eval.c:3093
        count = {bytes = <optimized out>}
        val = <optimized out>
#16 0x00007fffefd9e746 in F656c6563747269632d696e64656e742d706f73742d73656c662d696e736572742d66756e6374696f6e_electric_indent_post_self_insert_function_0 () at /home/sergio/programs/emacs/install/bin/../lib/emacs/30.1.90/native-lisp/30.1.90-a95199b5/preloaded/electric-a9ca6cdd-16dd18c6.eln
#17 0x00005555557682e6 in Ffuncall (nargs=1, args=0x7fffffffd118) at eval.c:3093
        count = {bytes = <optimized out>}
        val = <optimized out>
#18 0x0000555555768949 in funcall_nil (nargs=<optimized out>, args=<optimized out>) at eval.c:2776
#19 0x000055555576428f in run_hook_with_args (nargs=1, args=0x7fffffffd118, funcall=0x555555768940 <funcall_nil>) at eval.c:2946
        global_vals = 0x7ffff04fb0d3
        sym = 0xf240
        val = 0x5555578cd263
        ret = 0x0
#20 0x000055555576436f in Frun_hook_with_args (nargs=1, args=0x7fffffffd118) at eval.c:2818
#21 run_hook (hook=<optimized out>, hook@entry=0xf240) at eval.c:2966
#22 0x000055555571b45e in internal_self_insert (c=10, n=<optimized out>, n@entry=1) at cmds.c:498
        hairy = 1
        tem = <optimized out>
        synt = <optimized out>
        overwrite = <optimized out>
        len = <optimized out>
        str = "\n\377\377\177"
        chars_to_delete = <optimized out>
        spaces_to_insert = <optimized out>
#23 0x000055555571bf36 in Fself_insert_command (n=<optimized out>, c=0x2a) at cmds.c:297
        character = <optimized out>
        val = <optimized out>
#24 0x00007ffff013e518 in F6e65776c696e65_newline_0 () at /home/sergio/programs/emacs/install/bin/../lib/emacs/30.1.90/native-lisp/30.1.90-a95199b5/preloaded/simple-fab5b0cf-9904d6fb.eln
#25 0x00005555557682e6 in Ffuncall (nargs=nargs@entry=3, args=args@entry=0x7fffffffd328) at eval.c:3093
        count = {bytes = <optimized out>}
        val = <optimized out>
#26 0x0000555555760cfe in Ffuncall_interactively (nargs=3, args=0x7fffffffd328) at callint.c:250
        speccount = {bytes = <optimized out>}
#27 0x00005555557682e6 in Ffuncall (nargs=nargs@entry=4, args=args@entry=0x7fffffffd320) at eval.c:3093
        count = {bytes = <optimized out>}
        val = <optimized out>
#28 0x0000555555762322 in Fcall_interactively (function=<optimized out>, record_flag=<optimized out>, keys=<optimized out>) at callint.c:789
        speccount = {bytes = <optimized out>}
        arg_from_tty = <optimized out>
        key_count = <optimized out>
        record_then_fail = <optimized out>
        save_this_command = <optimized out>
        save_this_original_command = <optimized out>
        save_real_this_command = <optimized out>
        save_last_command = <optimized out>
        prefix_arg = <optimized out>
        enable = <optimized out>
        up_event = <optimized out>
        form = <optimized out>
        specs = <optimized out>
        sa_avail = <optimized out>
        sa_count = {bytes = <optimized out>}
        string_len = <optimized out>
        string = <optimized out>
        string_end = <optimized out>
        next_event = <optimized out>
        nargs = <optimized out>
        args = <optimized out>
        visargs = <optimized out>
        varies = <optimized out>
        tem = <optimized out>
        val = <optimized out>
#29 0x00007ffff014a93d in F636f6d6d616e642d65786563757465_command_execute_0 () at /home/sergio/programs/emacs/install/bin/../lib/emacs/30.1.90/native-lisp/30.1.90-a95199b5/preloaded/simple-fab5b0cf-9904d6fb.eln
#30 0x00005555557682e6 in Ffuncall (nargs=nargs@entry=2, args=args@entry=0x7fffffffd620) at eval.c:3093
        count = {bytes = <optimized out>}
        val = <optimized out>
#31 0x00005555556e86e5 in command_loop_1 () at keyboard.c:1550
        scount = {bytes = <optimized out>}
        cmd = <optimized out>
        keybuf = {0x36, 0x1a, 0x13710, 0x7ffff0da8034, 0x7ffff0da8034, 0x13710, 0x30, 0x0, 0x0, 0x7fffffffd750, 0x80, 0x4000000012000000, 0x0, 0x555555767053 <eval_sub+2179>, 0x7ffff06194f0, 0x5555560693e0, 0x7fff00000000, 0x7ffff0797188, 0x0, 0x60, 0x60, 0x7ffff0508583, 0x0, 0x55555585a788, 0x7ffff0925f9d, 0x555555764c94 <unbind_to+244>, 0x7ffff0508b23, 0x7ffff2e70ac0 <main_arena>, 0xb, 0xb310}
        i = <optimized out>
        last_pt = 12
        prev_modiff = 49
        prev_buffer = 0x555557abdf90
#32 0x0000555555763927 in internal_condition_case (bfun=bfun@entry=0x5555556e8300 <command_loop_1>, handlers=handlers@entry=0x90, hfun=hfun@entry=0x5555556db980 <cmd_error>) at eval.c:1613
        val = <optimized out>
        c = 0x5555560693e0
#33 0x00005555556d3dfe in command_loop_2 (handlers=handlers@entry=0x90) at keyboard.c:1168
        val = <optimized out>
#34 0x0000555555763881 in internal_catch (tag=tag@entry=0x122d0, func=func@entry=0x5555556d3dd0 <command_loop_2>, arg=arg@entry=0x90) at eval.c:1292
        val = <optimized out>
        c = 0x5555560692a0
#35 0x00005555556d3d93 in command_loop () at keyboard.c:1146
#36 0x00005555556db521 in recursive_edit_1 () at keyboard.c:754
        count = {bytes = <optimized out>}
        val = <optimized out>
#37 0x00005555556db8b0 in Frecursive_edit () at keyboard.c:837
        count = {bytes = <optimized out>}
        buffer = <optimized out>
#38 0x00005555555af771 in main (argc=6, argv=<optimized out>) at emacs.c:2646
        stack_bottom_variable = 0xe410
        old_argc = <optimized out>
        no_loadup = false
        junk = 0x0
        dname_arg = 0x0
        ch_to_dir = 0x0
        original_pwd = <optimized out>
        dump_mode = <optimized out>
        skip_args = 0
        temacs = 0x0
        attempt_load_pdump = <optimized out>
        only_version = false
        rlim = {rlim_cur = 10022912, rlim_max = 18446744073709551615}
        lc_all = <optimized out>
        sockfd = -1
        module_assertions = <optimized out>
--8<---------------cut here---------------end--------------->8---

I haven't had the time to compiled a non-optimized Emacs in order to
dive deep into the problem yet.

In GNU Emacs 30.1.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.49, cairo version 1.18.4) of 2025-07-01 built on
 emacs-compile-testing
Repository revision: 985ad1da76d2ea1ef70765fe8b4fb62fc975ae0a
Repository branch: emacs-30
Windowing system distributor 'The X.Org Foundation', version 11.0.12101016
System Description: Debian GNU/Linux 13 (trixie)

Configured using:
 'configure --prefix /home/sergio/programs/emacs/install/
 --with-native-compilation --with-tree-sitter --with-libsystemd
 --with-imagemagick --with-x=yes --without-gconf
 --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
IMAGEMAGICK JPEG LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT
MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND
SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM
XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
https://sergiodj.net/




Acknowledgement sent to Sergio Durigan Junior <sergiodj@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#78938; 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: Fri, 4 Jul 2025 07:45:02 UTC

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