From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63590: 29.0.90; can't load sqlite extension Date: Fri, 19 May 2023 19:36:21 +0300 Message-ID: <83a5y0th16.fsf@gnu.org> References: <2a8d4ca6-1fdf-98c7-6d4b-01f9cca30e8b@vogelsang.berlin> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2034"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63590@debbugs.gnu.org To: Lennart Vogelsang Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 19 18:37:13 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q036P-0000Ld-8x for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 May 2023 18:37:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q036H-0004TB-TJ; Fri, 19 May 2023 12:37:05 -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 1q036F-0004Sy-9F for bug-gnu-emacs@gnu.org; Fri, 19 May 2023 12:37:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q036F-0001Tc-0Y for bug-gnu-emacs@gnu.org; Fri, 19 May 2023 12:37:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q036E-0005Pw-Gs for bug-gnu-emacs@gnu.org; Fri, 19 May 2023 12:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 May 2023 16:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63590 X-GNU-PR-Package: emacs Original-Received: via spool by 63590-submit@debbugs.gnu.org id=B63590.168451417620769 (code B ref 63590); Fri, 19 May 2023 16:37:02 +0000 Original-Received: (at 63590) by debbugs.gnu.org; 19 May 2023 16:36:16 +0000 Original-Received: from localhost ([127.0.0.1]:57264 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q035U-0005Ot-8Y for submit@debbugs.gnu.org; Fri, 19 May 2023 12:36:16 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42218) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q035R-0005Of-3e for 63590@debbugs.gnu.org; Fri, 19 May 2023 12:36:14 -0400 Original-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 ) id 1q035L-0001IT-5P; Fri, 19 May 2023 12:36:07 -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=EhXe2S2YlK1biFaV2LSrtb+65YQrRepKMsMf4jAI5lo=; b=W0oKRabXv0qoReeopSwK 7X1wcZZcX3g1GFHd5Q0PyyMDEEQl1i7c3VoHBYGvc1zSAGCwCxA4Q73HJcdDkDnf273Y8fQQE116Y vGJOYMdFjEgnztyara/WwBo+qmV17vOJGdNBcYQbKHuyhb1C+eGG9R7K06lc5onKxksvcx+d+f3U3 nq7Dm6Sgy4sWfvSAmRttdicsLKI+oamiLohejk2sctEqj8I/C0BZAL2IlGbHx8je4SS9W55e4LLYo vxv8PPqQIh4VGdukJgUKX4t2LDdXbUMP9ZfzvK7t4rsTEg5FmDEPyOL2lg+F7v/HI+zmKV88ZqAmj GF0tSGDIlbc2DA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q035K-0004Bd-LG; Fri, 19 May 2023 12:36:06 -0400 In-Reply-To: <2a8d4ca6-1fdf-98c7-6d4b-01f9cca30e8b@vogelsang.berlin> (bug-gnu-emacs@gnu.org) 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:262014 Archived-At: > Date: Fri, 19 May 2023 15:25:21 +0200 > From: Lennart Vogelsang via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > I am experimenting around loading sqlite extensions into the builtin > sqlite capability of emacs. Sadly I do not seem to be able to load any > of csv extensions, even when their name appears in the hard coded > allow list in sqlite.c. > > To reproduce, I've created an empty folder, cd'ed into it, started > emacs -Q, copied the sqlite's csv extension source code [0] into > csvtable.c, > compiled it with > >      gcc -O3 -Wall -Wno-unknown-pragmas -fPIC -shared -lm -o > csvtable.so csvtable.c > > and executed the following elisp forms in the scratch buffer: > >      (setq-local mydb (sqlite-open)) >      (sqlite-load-extension mydb "./csvtable.so") > > I get a nil return value from the second expression, indicating > that it did not load the extension (verified by using the `csv` module > in a `sqlite-execute` call). If I try the same from the `sqlite3` cli > interface, it works: > >      .load ./csvtable.so > > Emacs's sqlite implementation does not setup the load extension config > (SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION [1]) anywhere as far as I could > gather, so I suspect that to be the root cause of the issue (the sqlite3 > cli sets that configuration). It has to be setup with the `use_config` > [2] c function, e.g. > > sqlite3_db_config(db,SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION,1,NULL) > > before one can load extensions via sqlite's c interface > `sqlite3_load_extension()` that emacs also uses [3]. > > For testing, I've tried compiling emacs with a small change > that adds the sqlite3_db_config call to the sqlite-open function, and > with this change, the above procedure works as expected. Are you saying that the SQL-related tests in the Emacs test suite don't work for you? See test/src/sqlite-tests.el. These tests were used to test the Emacs built-in SQL support, and I'm sure they worked when Lars, who developed that, worked on it. So how come this doesn't work for you?