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#60842: 29.0.50; Crash when printing sqlite object Date: Mon, 16 Jan 2023 15:16:12 +0200 Message-ID: <83y1q24o2r.fsf@gnu.org> References: <24bff60e-9e99-4479-84d2-2961fdfbaa38@Spark> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5860"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60842@debbugs.gnu.org To: Troy Hinckley , Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 16 14:17:26 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 1pHPMb-0001Kq-Kg for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Jan 2023 14:17:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHPML-000326-JI; Mon, 16 Jan 2023 08:17:09 -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 1pHPME-00030c-5c for bug-gnu-emacs@gnu.org; Mon, 16 Jan 2023 08:17:03 -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 1pHPMD-0006FL-RX for bug-gnu-emacs@gnu.org; Mon, 16 Jan 2023 08:17:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pHPMD-0001nn-NZ for bug-gnu-emacs@gnu.org; Mon, 16 Jan 2023 08:17:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Jan 2023 13:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60842 X-GNU-PR-Package: emacs Original-Received: via spool by 60842-submit@debbugs.gnu.org id=B60842.16738749766850 (code B ref 60842); Mon, 16 Jan 2023 13:17:01 +0000 Original-Received: (at 60842) by debbugs.gnu.org; 16 Jan 2023 13:16:16 +0000 Original-Received: from localhost ([127.0.0.1]:60795 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHPLT-0001mP-FJ for submit@debbugs.gnu.org; Mon, 16 Jan 2023 08:16:15 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHPLO-0001m9-W8 for 60842@debbugs.gnu.org; Mon, 16 Jan 2023 08:16:14 -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 1pHPLI-00066w-I4; Mon, 16 Jan 2023 08:16:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=3YN/5x6K1+5Uu7eWvZoaYKjt/DgZorgNvHAFpKmuHxk=; b=UbzqaFlZxj3E 0+u93xj8ba6JIzShar47mrSBD7sPYMVcL3Nd42KtkDdjNdiUZVyov0CL2+ZgkxosjR9rdLFC+iQdD M8zJPTchFr3RXVpyLudgS/jdlr09xivN7xHgNfTvwebkg6Y8CAULi3w3ICI9O6kHQQ/bcLaR6KfCR QShUif5Zl4t90LWr80gFawZc1ZJAxlXyuWMH3mwP86a/YIhXVoLmULfjaJ6yT2ukSn9k3oE4GiU8o FL5SFxC+8cT/d2QQHe5ZZOP0I5W9ZtgWUG/bn+nWYa5ppD9AZrgWsYllYuSgLfIsHx4yzILAuCDa8 M58HEzySxoOrL112tQA43A==; 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 1pHPLI-00039k-0U; Mon, 16 Jan 2023 08:16:04 -0500 In-Reply-To: <24bff60e-9e99-4479-84d2-2961fdfbaa38@Spark> (message from Troy Hinckley on Sun, 15 Jan 2023 16:38:52 -0700) 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:253487 Archived-At: > Date: Sun, 15 Jan 2023 16:38:52 -0700 > From: Troy Hinckley > > I have run into a reproducible crash when trying to print a sqlite > object on Emacs 29. This is the code that will lead to the crash with > emacs -Q: > > (prin1-to-string (sqlite-open > "/Users/troyhinckley/.emacs.d/var/org/org-roam.db")) > > Iterestingly it will only happen when using something that matches that > path. Creating sqlite db anywhere else does not cause an issue. The path > passed to sqlite-open has to start with > /Users/troyhinckley/.emacs.d/var/org/org-roam > > Will crash when printed: > /Users/troyhinckley/.emacs.d/var/org/org-roam.db > /Users/troyhinckley/.emacs.d/var/org/org-roams.db > /Users/troyhinckley/.emacs.d/var/org/org-roam-foo.db > /Users/troyhinckley/.emacs.d/var/org/org-roam.xz > > Will not crash when printed: > /Users/troyhinckley/.emacs.d/var/org/org-roa.db > /Users/troyhinckley/.emacs.d/var/org-roam.db > /Users/troyhinckley/.emacs.d/var/org/org-roa > > so it requires that prefix text. This happens even when I delete the db > at that path. Also it is not the sqlite-open that crashes. That works > fine. It is the call to prin1-to-string that crashes (you can see this > in the backtrace as well). > > My best guess is that the sqlite library is caching some information > about different databases somewhere on the system, and that has become > corrupted, leading it to return something invalid when asked to print > the object. That would explain why only things starting with that path > will crash. I have no idea where that might be. > > BACKTRACE: > > (lldb) bt all > * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT > * frame #0: 0x00000001974ce1b0 libsystem_kernel.dylib`__pthread_kill + 8 > frame #1: 0x0000000197504cec libsystem_pthread.dylib`pthread_kill + 288 > frame #2: 0x000000019743e354 libsystem_c.dylib`__abort + 128 > frame #3: 0x000000019742fd34 libsystem_c.dylib`__stack_chk_fail + 96 > frame #4: 0x000000010476e528 Emacs`print_object + 5496 > frame #5: 0x0000000104770308 Emacs`Fprin1_to_string + 132 Given that the abort is inside what sounds like the macOS run-time stack-checking function, crystal ball says this is related to what print_object does at the get-go: print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) { ptrdiff_t base_depth = print_depth; ptrdiff_t base_sp = prstack.sp; char buf[max (sizeof "from..to..in " + 2 * INT_STRLEN_BOUND (EMACS_INT), max (sizeof " . #" + INT_STRLEN_BOUND (intmax_t), max ((sizeof " with data 0x" + (sizeof (uintmax_t) * CHAR_BIT + 4 - 1) / 4), 40)))]; current_thread->stack_top = buf; <<<<<<<<<<<<<<<<<<<<<<<<<< If you remove the indicated line, does the crash go away? If removing that line doesn't help, please tell the dimension of the buf[] array that the code above calculates? In GDB, this is possible with the command 'ptype'; I don't know what is the lldb equivalent. > In GNU Emacs 29.0.50 (build 1, aarch64-apple-darwin22.1.0, NS > appkit-2299.00 Version 13.0 (Build 22A380)) of 2022-12-05 built on > Troys-MacBook-Pro.local > Windowing system distributor 'Apple', version 10.3.2299 > System Description: macOS 13.1 This is a month-old build -- could you try with the latest emacs-29 branch of the Emacs Git repository? Paul, any ideas or suggestions? Thanks.