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#69952: [PATCH] Support pdumping compiled queries by dumping their source Date: Sun, 21 Apr 2024 23:25:10 -0700 Message-ID: References: <86r0g1zaqi.fsf@gnu.org> <86le5hr9oj.fsf@gnu.org> <861q709y5y.fsf@gnu.org> <9B2A2190-AB42-4F1B-9F9D-5623B343CF0A@gmail.com> <86frvf8gf9.fsf@gnu.org> <86eday6j9o.fsf@gnu.org> <868r157wdy.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6.1.1\)) 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="34183"; mail-complaints-to="usenet@ciao.gmane.io" Cc: serg.foo@gmail.com, dancol@dancol.org, 69952@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 22 08:26:16 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 1ryn83-0008cd-Je for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Apr 2024 08:26:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ryn7j-0005gy-HO; Mon, 22 Apr 2024 02:25:56 -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 1ryn7f-0005gh-Ff for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2024 02:25:51 -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 1ryn7b-0002tz-IZ for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2024 02:25:48 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ryn7r-0002fK-4D for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2024 02:26:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Apr 2024 06:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 69952-submit@debbugs.gnu.org id=B69952.171376714810144 (code B ref 69952); Mon, 22 Apr 2024 06:26:02 +0000 Original-Received: (at 69952) by debbugs.gnu.org; 22 Apr 2024 06:25:48 +0000 Original-Received: from localhost ([127.0.0.1]:45528 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryn7b-0002dN-9x for submit@debbugs.gnu.org; Mon, 22 Apr 2024 02:25:48 -0400 Original-Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:54436) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryn7Y-0002ck-1M for 69952@debbugs.gnu.org; Mon, 22 Apr 2024 02:25:45 -0400 Original-Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-5ca29c131ebso2683248a12.0 for <69952@debbugs.gnu.org>; Sun, 21 Apr 2024 23:25:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713767122; x=1714371922; 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=Edxe9rTruBKL0elmB9j2RgtgrFcz6pUzx/tJFYTK7iw=; b=Bzv2RY3XPI6WU/izRuR+ZmOSGzaXaO6WYcRpqlxZCS0/ZHicweW/LKiZcKGV10+ro/ VRcedg9NxDH9nVCAVYbCEtDRY56+iqSp1EJbD+M1KPFMiocjVCGTJvCC3H/ZdCVa1PW2 lvo+V6tjAwLIjO/oK7CrxDJjGxfgORGockqpfFWbZyhDB8nr481/yuajuWg/K2aWnABf CnIFTwM3MqgnDIWZhFXhzzZh4r81uRjHtv12IKMv9avw+MLqvq+XyRNaNy3QbHZTW6nr zKACmnTp9gsdXGlhy1tszwjWjUc2WmE3J1xv83tt9vWEx7dlELGFN3cjAnqaltquFoX4 sXIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713767122; x=1714371922; 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=Edxe9rTruBKL0elmB9j2RgtgrFcz6pUzx/tJFYTK7iw=; b=MXqCTUczP3p0IF6mdDGfqttNAIUO9tIxnT3qi255Yv4FwO5r3h4xT1lAv5mJtrf/YN fxuBqBeltczRQ8bt1TpK1av41ZLtMWqYyfEMEc3iHuFpIMk4y7mJspBtf9ZGHK4swCus dEy68j4O4CODhRAnCk9hvlB8Vl5DehJJI359apI73QeV4AwUITKdlTEASng1MDusdhMW 9rlG51Gk2jmWywCazOe2me8JlDY+F3780hVjQnsPSG9YIy8YvI5v0R4/kW8k6y0V/aIx JGRPP9JeiAPXoex39rB3lN/S0x+HOVCUTqnhm69IyGTRTtFEkykaWcKOWwG9eEA/lp8r sqRg== X-Forwarded-Encrypted: i=1; AJvYcCV1dIHvpX+pmKMHRCYWGH9VZNrp/WPe5stPfZU08eBlK06J27p77WEduc3+fuxFoeIOwQg7zx+UeYPYj+3Wy34+Q+y84EI= X-Gm-Message-State: AOJu0YwjtMRX27opbTnQayMkZ4gsiANjXUCKSHMQ5xA9AuC1H/gkhSws KVt0uCP9BDBCPziVebKHYMsTtVJjVVb8ggsLMqf52YxRKxNvWFDB X-Google-Smtp-Source: AGHT+IGZ9joq9nsctTbm9PnPTFbngbMbOzGMSOVhOuYWRAutkdSeRpZLsDxiHmAo3MsL+mROUZ43Xw== X-Received: by 2002:a05:6a21:150a:b0:1ad:12da:e5d2 with SMTP id nq10-20020a056a21150a00b001ad12dae5d2mr4806606pzb.55.1713767122261; Sun, 21 Apr 2024 23:25:22 -0700 (PDT) Original-Received: from smtpclient.apple ([2601:641:300:4910:e4f6:f0b8:c91d:e40b]) by smtp.gmail.com with ESMTPSA id g14-20020a62f94e000000b006f2d97c3e87sm1108670pfm.125.2024.04.21.23.25.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Apr 2024 23:25:21 -0700 (PDT) In-Reply-To: <868r157wdy.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.700.6.1.1) 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:283805 Archived-At: > On Apr 21, 2024, at 11:18 PM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Sun, 21 Apr 2024 23:04:47 -0700 >> Cc: Daniel Colascione , >> serg.foo@gmail.com, >> 69952@debbugs.gnu.org >>=20 >>>> No. You need both tree-sitter library and the grammar library. >>>=20 >>> That's what I thought. So starting Emacs in that case will attempt = to >>> call a function from the tree-sitter library, and will segfault, >>> right? If so, we should have some protection in the code in >>> pdumper.c that loads queries, which tests that tree-sitter is >>> availabale, and if not does something to prevent the segfault, like >>> not loading the query, perhaps? >>=20 >> Right, it can use Ftreesit_available_p (we can define a C equivalent = if pdumper can=E2=80=99t call lisp), and decide whether to compile the = query or just keep the query as a string, or signal an error? >=20 > We cannot safely signal an error at that point, I think, so just > keeping the query as a string should do, as it will then signal an > error at run time when that query is used, is that right? Yes, most likely a function-undefined signal, since all the treesit.c = functions like treesit-query-capture or treesit-query-compile will be = nonexistent. And usually the Lisp program trying to use the query would = check for tree-sitter availability with treesit-available-p before = trying to use any tree-sitter functions; so that signal will be usually = avoided as well. Yuan=