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#60872: 29.0.60; emacsql broken after Jan 12 change Date: Tue, 17 Jan 2023 14:45:30 +0200 Message-ID: <83y1q12utx.fsf@gnu.org> References: <874jspwyrr.fsf@gmail.com> <87mt6hcwcq.fsf@gmail.com> 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="22753"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60872@debbugs.gnu.org, emacs18@gmail.com To: Robert Pluim , Jonas Bernoulli Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 17 13:46:31 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 1pHlMD-0005hq-DT for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Jan 2023 13:46:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHlM0-000501-3u; Tue, 17 Jan 2023 07:46:17 -0500 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 1pHlLn-0004xw-Qu for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2023 07:46:06 -0500 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 1pHlLn-0001Ga-2v for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2023 07:46:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pHlLm-00024E-IE for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2023 07:46:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Jan 2023 12:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60872 X-GNU-PR-Package: emacs Original-Received: via spool by 60872-submit@debbugs.gnu.org id=B60872.16739595307906 (code B ref 60872); Tue, 17 Jan 2023 12:46:02 +0000 Original-Received: (at 60872) by debbugs.gnu.org; 17 Jan 2023 12:45:30 +0000 Original-Received: from localhost ([127.0.0.1]:36033 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHlLF-00023S-Qu for submit@debbugs.gnu.org; Tue, 17 Jan 2023 07:45:30 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50462) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHlLD-00023E-63 for 60872@debbugs.gnu.org; Tue, 17 Jan 2023 07:45:29 -0500 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 1pHlL6-000192-Os; Tue, 17 Jan 2023 07:45:20 -0500 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=ZmUlH9ap5hyODEFhiA7SsAXqZX/u02wivvmujHJndHk=; b=UBpqJOIw1wLAe3PSCRrt yyw3DmIqq/DCSLEwSPjgvZ/1PwR2+IYdNGsgKwOLuMVWKgQk5a5UXW+CEyX6AdL3lNDyeUmmR8mai g/GIGbXaZhPTt4cLHROEcYa5EJJPD8vxDjgZmATdo0ZN6L2z8Hf+BPrueG/hQMlGa2CjUCfxPwN8h XPXHAB45Q1zANEF5b9h7v2H1vAJKtprxjvqyeK4Fiwp+M9RqTsEq5z9Yfecr9hhcHnwc0QlcMLRiR fDqfYfOf7sJ5RdWk6ZG/nOaPnCDNuhuQ/94n+6tcN4DV5JiG5WRtJ54xz6gGZJ77pNwQc/CjazRPK ikjw0Q7HzuBD9g==; 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 1pHlL5-0002UP-Vg; Tue, 17 Jan 2023 07:45:20 -0500 In-Reply-To: <87mt6hcwcq.fsf@gmail.com> (message from Robert Pluim on Tue, 17 Jan 2023 11:02:29 +0100) 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:253545 Archived-At: > From: Robert Pluim > Cc: 60872@debbugs.gnu.org, Eli Zaretskii > Date: Tue, 17 Jan 2023 11:02:29 +0100 > > >>>>> On Mon, 16 Jan 2023 20:50:00 -0800, Richard Kim said: > > Richard> On Jan 12 Eli checked in cfd2b3504ab on emacs-29 branch on Jan 12 which seemed to have broken emacssql used by org-roam package. Following is the stack trace I get using emacs-29 built after cfd2b3504ab was checked in. > > Richard> ,---- > Richard> | Debugger entered--Lisp error: (error "Selecting deleted buffer") > Richard> | #f(compiled-function (connection) "Return true if the end of the buffer has a properly-formatted prompt." #)(#) > Richard> | apply(#f(compiled-function (connection) "Return true if the end of the buffer has a properly-formatted prompt." #) # nil) > > I can reproduce this, itʼs because the sqlite process is dying > almost straight away in emacsql-sqlite.el: > > (cl-defmethod initialize-instance :after > ((connection emacsql-sqlite-connection) &rest _rest) > (emacsql-sqlite-ensure-binary) > (let* ((process-connection-type nil) ; use a pipe > (coding-system-for-write 'utf-8-auto) > (coding-system-for-read 'utf-8-auto) > (file (slot-value connection 'file)) > (buffer (generate-new-buffer " *emacsql-sqlite*")) > (fullfile (if file (expand-file-name file) ":memory:")) > (process (start-process <== dies > "emacsql-sqlite" buffer emacsql-sqlite-executable fullfile))) > (setf (slot-value connection 'process) process) > (setf (process-sentinel process) > (lambda (proc _) (kill-buffer (process-buffer proc)))) > (emacsql-wait connection) > (emacsql connection [:pragma (= busy-timeout $s1)] > (/ (* emacsql-global-timeout 1000) 2)) > (emacsql-register connection))) > > If I use > > (coding-system-for-read 'utf-8) > > instead it all works fine. coding-system-for-read or coding-system-for-write? The offending commit didn't change anything about decoding, it only changed how utf-8-auto behaves on _encoding_. So I expect the problem to be with coding-system-for-write. Anyway, it sounds like someone else thought utf-8-auto is about EOL format? Setting coding-system-for-write to utf-8-auto makes no sense; that coding-system's _only_ raison d'être is for using in coding-system-for-read, i.e. when decoding stuff that may or may not start with a BOM. Jonas, any idea why these coding-systems are used in emacsql-sqlite.el? The Git log of the package offers no explanation, and I find no references to it in Issues or PRs around the date of the commit. If indeed there's sometimes a need to send to the process stuff that is encoded in UTF-8 with BOM, then instead of binding coding-system-for-write around start-process, you should set it using set-process-coding-system only _after_ the process starts, because the way the code is written now, utf-8-auto is also used to encode the command-line arguments to the sub-process, and so, for example, fullfile (which I presume is a file name?) gets the BOM prepended, and I'm guessing the program emacsql-sqlite isn't prepared for that, and exits abnormally. > Eli, what debug would you like? If I donʼt kill the " *emacsql-sqlite*" > buffer it contains I don't think there's anything to debug, the reason is quite clear: a bug in emacsql-sqlite.el.