From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lennart Vogelsang via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#63590: 29.0.90; can't load sqlite extension Date: Fri, 19 May 2023 15:25:21 +0200 Message-ID: <2a8d4ca6-1fdf-98c7-6d4b-01f9cca30e8b@vogelsang.berlin> Reply-To: Lennart Vogelsang Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22227"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 To: 63590@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 19 17:22:21 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 1q01vv-0005TT-Uh for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 May 2023 17:22:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01vh-0007uL-VO; Fri, 19 May 2023 11:22: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 1q01vg-0007te-Lo for bug-gnu-emacs@gnu.org; Fri, 19 May 2023 11:22:04 -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 1q01vg-0005RM-Dq for bug-gnu-emacs@gnu.org; Fri, 19 May 2023 11:22:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q01vg-0000m3-8c for bug-gnu-emacs@gnu.org; Fri, 19 May 2023 11:22:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lennart Vogelsang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 May 2023 15:22:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63590 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16845096962893 (code B ref -1); Fri, 19 May 2023 15:22:04 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 May 2023 15:21:36 +0000 Original-Received: from localhost ([127.0.0.1]:57134 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q01vD-0000kV-Bh for submit@debbugs.gnu.org; Fri, 19 May 2023 11:21:36 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:33280) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q006x-0000lx-6w for submit@debbugs.gnu.org; Fri, 19 May 2023 09:25:35 -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 1q006u-0002us-Bv for bug-gnu-emacs@gnu.org; Fri, 19 May 2023 09:25:33 -0400 Original-Received: from mx1.vogelsang.berlin ([195.201.7.160]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q006s-0004du-4E for bug-gnu-emacs@gnu.org; Fri, 19 May 2023 09:25:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vogelsang.berlin; s=mx1; t=1684502724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fNHO0tvsEHj9UUUGKW3WnzhHNOjlwflRj98NGhg59LA=; b=nDNo6NTqNg0OeXCcoQUUiksWyXZANdlP4gFtV1RkQb7fMKccA/vdSDiVl4/4Xrb490NA9C b3n6lcuTLdAiNB0cjmiKMYwYHmTmsgtxOQerpM9WiR4fESlti0I4LrT9K7QSK9G0oTLjI6 eWCkjTQEXAYlaRXuLW4BoXc90dZgiLg= Original-Received: from [IPV6:2a02:8109:9d40:1240:2ef0:5dff:fe04:f2a4] ( [2a02:8109:9d40:1240:2ef0:5dff:fe04:f2a4]) by mx1.vogelsang.berlin (OpenSMTPD) with ESMTPSA id 2586e8cf (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for ; Fri, 19 May 2023 15:25:22 +0200 (CEST) Content-Language: en-US Received-SPF: pass client-ip=195.201.7.160; envelope-from=lennart@vogelsang.berlin; helo=mx1.vogelsang.berlin 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_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-Mailman-Approved-At: Fri, 19 May 2023 11:21:30 -0400 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:262005 Archived-At: Dear maintainers, 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. If someone with more experience and knowledge could confirm that this is indeed the issue and that a patch is wanted, I am happy to make a small patch that adds the configuration to the sqlite-open function of sqlite.c (or would there be a better position to add that config setting?). Happy greetings, Lennart Additional sources: [0] https://www.sqlite.org/src/artifact?ci=trunk&filename=ext/misc/csv.c [1] https://www.sqlite.org/c3ref/c_dbconfig_defensive.html#sqlitedbconfigenableloadextension [2] https://www.sqlite.org/c3ref/db_config.html [3] https://www.sqlite.org/loadext.html In GNU Emacs 29.0.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo version 1.17.8) of 2023-04-27 built on Jupiter Repository revision: c46e93b1f50c9a6f7143f347d96a6385bcdf3a05 Repository branch: emacs-29 System Description: Arch Linux Configured using: 'configure --with-pgtk --with-treesitter' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date subr-x cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo gtk pgtk lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 36722 8121) (symbols 48 5117 0) (strings 32 13127 1970) (string-bytes 1 373207) (vectors 16 9308) (vector-slots 8 148657 12041) (floats 8 22 22) (intervals 56 310 0) (buffers 984 11))