From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#70059: 30.0.50; c-ts-mode crashes emacs Date: Tue, 2 Apr 2024 11:22:44 -0700 Message-ID: <57C4D40E-15B1-4A8C-8FA7-C01A16A81BA9@gmail.com> References: <877chmccux.fsf@web.de> <86edbtfvge.fsf@gnu.org> <87il15wbtx.fsf@web.de> <86zfuhe0uo.fsf@gnu.org> <878r218e1s.fsf@web.de> <86wmpldyve.fsf@gnu.org> <92195FEF-E940-41F7-B1A8-EC1607D9473E@gmail.com> <87a5mex1oi.fsf@web.de> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37958"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 70059@debbugs.gnu.org To: Felix Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 02 20:24:37 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rrioH-0009hD-7Z for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 02 Apr 2024 20:24:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rrinm-0005xp-My; Tue, 02 Apr 2024 14:24:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rrinf-0005wv-C8 for bug-gnu-emacs@gnu.org; Tue, 02 Apr 2024 14:24:00 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rrine-0001Jo-Rm for bug-gnu-emacs@gnu.org; Tue, 02 Apr 2024 14:23:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rrini-0004RN-Md for bug-gnu-emacs@gnu.org; Tue, 02 Apr 2024 14:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Apr 2024 18:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70059 X-GNU-PR-Package: emacs Original-Received: via spool by 70059-submit@debbugs.gnu.org id=B70059.171208219316762 (code B ref 70059); Tue, 02 Apr 2024 18:24:02 +0000 Original-Received: (at 70059) by debbugs.gnu.org; 2 Apr 2024 18:23:13 +0000 Original-Received: from localhost ([127.0.0.1]:56314 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rrimr-0004ME-MJ for submit@debbugs.gnu.org; Tue, 02 Apr 2024 14:23:13 -0400 Original-Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:61442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rrimn-0004Kn-IJ for 70059@debbugs.gnu.org; Tue, 02 Apr 2024 14:23:07 -0400 Original-Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6e46dcd8feaso2538614b3a.2 for <70059@debbugs.gnu.org>; Tue, 02 Apr 2024 11:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712082176; x=1712686976; 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=nm/i0uXSXUf31ymip9OP3A4JUVu0MC2uxgKx1Sm5Fj8=; b=SxFsLSNNTJ3dEM6xeTYy5VJgBQ3zVi0cPQTqp4ptcbUMdSLRf978FxXOzOvhvYMqYC yVeobdFZzVN8kJfCAY5pJQDPpZsE8TdWP0ETJzUvW/VnoABPWSmAGY7L7TeuQISrk/PY 22qbT447UoqIFDWFshNnYcSb1DrO+t4EPBdzpfCqMcdZVaSpXAYPtWQWbZ3I9ggAHpoI mSio24eFCxR07tzh847l5Bi8sNCtkUt+ve6F0YhyVTifd3SP9skzp3e5hpkELmHm0NLN OFYKFlHdZ1uRU0+3hYLXb3RQLsgjibmFVRMcP8UJ5XZsGOJcYMa6bYoZfZ1LG8Dco5qf hR9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712082176; x=1712686976; 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=nm/i0uXSXUf31ymip9OP3A4JUVu0MC2uxgKx1Sm5Fj8=; b=w0cd7f3vR/pFdsS7G0jM8t1HFz3TJbR7o4ZFway/BYUMIxOHTtZdDMcKPem1CgTHdt ESwlsmzPoJBuJidDakbF3oMn65JDH0jCijMyJGpIkKsJj24cMSJOP2VbACupRon/WkMY f6QL2e44/obFuOixguZjw0bfUHYAm4esVS/trf3Y1w1343v4HNmKZAzEW76sH7CS93Ab TwShS0h2NKuIlR4fb+jNFs++/u/WR7d7hT+7cAK82B/BZjeCNpBTinKSsvS/IFA82bE9 SHhMUPH+slzLBS5PRKgVJ94/4NN7aZUlHVzbyq/KUbUtccD1FrNjaQVGjgWM7iUGWEFz O3PQ== X-Forwarded-Encrypted: i=1; AJvYcCX9OpoCuKpS1jUqm2gJ1K7u7aDh+vLpWnwllSE2efhofP0i0UqqyWdz+Ebk5KpEcZTOl0yGHwNpg7IUsHsnw7JhSf8Reho= X-Gm-Message-State: AOJu0YwlALWogszReVOpAJrCYz6u4oAUoSpBjfif9m3Wr+W5eiGivcAT mrI5/PWm21SnJnVQnCKxrVeZywCm3ss9mqav4pJYO4X5FVIGS0EMfTTk9JpP X-Google-Smtp-Source: AGHT+IFOtkAGd4oLnjeu3rIXbVsqpovDkI561apr9bz2pPBaKEDHt6yliwCxgXIVJQZ3Fs4TKAcacw== X-Received: by 2002:a05:6a20:5649:b0:1a3:c897:b67c with SMTP id is9-20020a056a20564900b001a3c897b67cmr10037177pzc.52.1712082175849; Tue, 02 Apr 2024 11:22:55 -0700 (PDT) Original-Received: from smtpclient.apple ([2601:641:300:4910:3c86:aadd:4f00:56cd]) by smtp.gmail.com with ESMTPSA id jf5-20020a170903268500b001e28654d2a6sm816854plb.219.2024.04.02.11.22.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Apr 2024 11:22:55 -0700 (PDT) In-Reply-To: <87a5mex1oi.fsf@web.de> X-Mailer: Apple Mail (2.3731.700.6) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:282540 Archived-At: > On Mar 31, 2024, at 1:09 AM, Felix wrote: >=20 > Yuan Fu writes: >=20 >>> On Mar 29, 2024, at 5:08 AM, Eli Zaretskii wrote: >>>=20 >>>> From: Felix >>>> Cc: Yuan Fu , 70059@debbugs.gnu.org >>>> Date: Fri, 29 Mar 2024 12:37:03 +0100 >>>>=20 >>>> Eli Zaretskii writes: >>>>=20 >>>>>> From: Felix >>>>>> Cc: Andrea Corallo , 70059@debbugs.gnu.org >>>>>> Date: Fri, 29 Mar 2024 11:51:06 +0100 >>>>>>=20 >>>>>> I rebuild it without native-compilation, and it still crashes. >>>>>> Backtrace: >>>>>>=20 >>>>>> #0 0x000077b79c65c32c in ??? () at /usr/lib/libc.so.6 >>>>>> #1 0x000077b79c60b6c8 in raise () at /usr/lib/libc.so.6 >>>>>> #2 0x00005a5a428f94a2 in terminate_due_to_signal () >>>>>> #3 0x00005a5a42933c23 in emacs_abort () >>>>>> #4 0x00005a5a429ec268 in signal_or_quit () >>>>>> #5 0x00005a5a429eb422 in Fsignal () >>>>>> #6 0x00005a5a429eb401 in xsignal () >>>>>> #7 0x00005a5a429e9aa2 in xsignal2 () >>>>>> #8 0x00005a5a429c0865 in wrong_type_argument () >>>>>> #9 0x00005a5a42965e1f in Fexpand_file_name () >>>>>> #10 0x00005a5a42b3d200 in Fdo_auto_save.7873 () >>>>>> #11 0x00005a5a428f9738 in shut_down_emacs () >>>>>> #12 0x00005a5a428f946a in terminate_due_to_signal () >>>>>> #13 0x00005a5a42935924 in handle_sigsegv () >>>>>> #14 0x000077b79c60b770 in () at = /usr/lib/libc.so.6 >>>>>> #15 0x00005a5a429a57f6 in process_mark_stack () >>>>>> #16 0x00005a5a429a677b in mark_char_table () >>>>>> #17 0x00005a5a429a68c6 in mark_char_table () >>>>>> #18 0x00005a5a429a55bd in process_mark_stack () >>>>>> #19 0x00005a5a429a677b in mark_char_table () >>>>>> #20 0x00005a5a429a68c6 in mark_char_table () >>>>>> #21 0x00005a5a429a55bd in process_mark_stack () >>>>>> #22 0x00005a5a429a677b in mark_char_table () >>>>>> #23 0x00005a5a429a68c6 in mark_char_table () >>>>>> #24 0x00005a5a429a55bd in process_mark_stack () >>>>>> #25 0x00005a5a429a677b in mark_char_table () >>>>>> #26 0x00005a5a429a68c6 in mark_char_table () >>>>>> #27 0x00005a5a429a55bd in process_mark_stack () >>>>>> #28 0x00005a5a429a569b in process_mark_stack () >>>>>> #29 0x00005a5a429a569b in process_mark_stack () >>>>>> #30 0x00005a5a429a569b in process_mark_stack () >>>>>> #31 0x00005a5a429a7b8e in garbage_collect () >>>>>> #32 0x00005a5a429e76e7 in Ffuncall () >>>>>> #33 0x00005a5a42a094f7 in mapcar1 () >>>>>> #34 0x00005a5a42a091bf in Fmapconcat () >>>>>> #35 0x00005a5a42ac9d90 in Ftreesit_pattern_expand () >>>>>> #36 0x00005a5a429e87b3 in funcall_subr () >>>>>> #37 0x00005a5a429e77f6 in Ffuncall () >>>>>> #38 0x00005a5a42a094f7 in mapcar1 () >>>>>> #39 0x00005a5a42a091bf in Fmapconcat () >>>>>> #40 0x00005a5a42ac9d90 in Ftreesit_pattern_expand () >>>>>> #41 0x00005a5a429e87b3 in funcall_subr () >>>>>> #42 0x00005a5a429e77f6 in Ffuncall () >>>>>> #43 0x00005a5a42a094f7 in mapcar1 () >>>>>> #44 0x00005a5a42a091bf in Fmapconcat () >>>>>> #45 0x00005a5a42aca243 in treesit_ensure_query_compiled () >>>>>> #46 0x00005a5a42aca5c0 in Ftreesit_query_capture () >>>>>=20 >>>>> Then it's strange, since it doesn't happen here. Does it happen = for >>>>> you with any C source file, including those in the Emacs source = tree? >>>>> If this happens only for some files, can you post one such file? >>>>>=20 >>>>> Also, what version of the tree-sitter library are you using, and = what >>>>> version of the C grammar library? >>>>>=20 >>>>> If you can build the emacs-29 branch, can you try reproducing = there? >>>>>=20 >>>>> Yuan, any ideas, based on the backtrace? >>>>=20 >>>> I was using tree-sitter build from the git repository, when i use = it >>>> from the official arch linux repos, it doesn't crash (at least = until >>>> now). >>>> I think this is tree-sitter related, but it shouldn't be able to = crash >>>> emacs, should it? >>>=20 >>> It shouldn't, unless there's some memory-related snafu (which could >>> explain why the crash is always in GC). I hope Yuan will be able to >>> tell. >>=20 >> It=E2=80=99s a bit strange since Ftreesit_pattern_expand doesn=E2=80=99= t call >> tree-sitter function. This function just expands a sexp query like >> '(function_definition @capture) to a string =E2=80=9C(function_definiti= on >> @capture)=E2=80=9D. >>=20 >> Perhaps something it does triggers GC and GC tries to collect some = tree-sitter node or parser, and there=E2=80=99s some problem when = freeing the node or parser with that version of tree-sitter library. >>=20 >> Also, I couldn=E2=80=99t reproduce with upstream tree-sitter plus = emacs master >> either. I=E2=80=99m using commit = 0b4403294981ffb6a51d153a5509a389b91fed86 for >> tree-sitter and commit 411f46fd365bc0008c58e1fa6bee6a60d841da75 for >> emacs. Felix, what commit are you using? >>=20 >> Yuan >=20 > It still crashes on my computer if i use: > GNU Emacs 30.0.50 (build 11, x86_64-pc-linux-gnu, GTK+ Version = 3.24.41, cairo version 1.18.0) of 2024-03-31 > and > tree-sitter 0.22.2 (fc15f621334a262039ffaded5937e2844f88da61) >=20 > But as i wrote, it doesn't crash with tree-sitter from the official = arch > linux repos, and because i program in C every day, i switched to the > stable tree-sitter and had no problems since. >=20 > That's why i asked if a faulty tree-sitter should be able to crash > emacs. If that is acceptable, this bug report can be closed. I mean tree-sitter (the library) runs in the main thread, if it triggers = a segfault, AFAIK Emacs currently can=E2=80=99t really do anything. Is = that right Eli? Yuan=