From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrew Hyatt Newsgroups: gmane.emacs.bugs Subject: bug#58850: 29.0.50; sqlite crashes on error Date: Tue, 1 Nov 2022 00:28:36 -0400 Message-ID: References: <6698F81B-6E83-403D-8D7C-DCAC4F9D07D0@gmail.com> <83ilk3hycm.fsf@gnu.org> <835yg1hl9k.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000005447905ec61298a" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37770"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58850@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 01 05:29:36 2022 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 1opiu7-0009hS-CC for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 01 Nov 2022 05:29:35 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opitc-0001KD-E6; Tue, 01 Nov 2022 00:29:04 -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 1opita-0001K0-Te for bug-gnu-emacs@gnu.org; Tue, 01 Nov 2022 00:29:02 -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 1opita-0007gZ-Lo for bug-gnu-emacs@gnu.org; Tue, 01 Nov 2022 00:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1opita-00051H-GI for bug-gnu-emacs@gnu.org; Tue, 01 Nov 2022 00:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrew Hyatt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Nov 2022 04:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58850 X-GNU-PR-Package: emacs Original-Received: via spool by 58850-submit@debbugs.gnu.org id=B58850.166727693619283 (code B ref 58850); Tue, 01 Nov 2022 04:29:02 +0000 Original-Received: (at 58850) by debbugs.gnu.org; 1 Nov 2022 04:28:56 +0000 Original-Received: from localhost ([127.0.0.1]:42409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opitU-00050x-50 for submit@debbugs.gnu.org; Tue, 01 Nov 2022 00:28:56 -0400 Original-Received: from mail-yb1-f177.google.com ([209.85.219.177]:43829) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opitR-00050j-LP for 58850@debbugs.gnu.org; Tue, 01 Nov 2022 00:28:54 -0400 Original-Received: by mail-yb1-f177.google.com with SMTP id n130so16009235yba.10 for <58850@debbugs.gnu.org>; Mon, 31 Oct 2022 21:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=OSYtpbg7qRL7caa4Tq7PXQ3CMKQ2okMme+2IxZzjoYo=; b=DLuebrHSAWx5TfsXCuhmCDFqglOz0D31RAJjQhZ4wvlekjxj/1GXxblGsAd7TCQpU4 rv3WH+I+fvA8PrqcRllJGy6BygfZtAAokCb+vM0iK+o/RPQBbIBOa0qxlLS1XQ2r9Ha2 AehkOpsi9z8uHx6dUDqIyXrb6KRMUJjP1TgnxfoKUZzw5vLX3fpigKeN/gmM3uM97aZ1 5MtLGDutv3i7t4KOiObUbQEKGx5kgsbrQScXPaCOX7vWLgtG74Al7FRGJcqpQqxtQ//r LiHdiVMMJqMi+Tgcb+kB+8/OZpvZyk+twYDQV8IbZ3CEf+cB9E6nL4JaBMJZN39VR6zv WSHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OSYtpbg7qRL7caa4Tq7PXQ3CMKQ2okMme+2IxZzjoYo=; b=b0JDgtdD8smUuUIzE9iQiZzmRqYw+juJFCCcbthuERFtCZvVC5Yxk+S5hDUP/QrEV7 24/JmwtJ/Kf1MFg4KRUfg1coVv9OU9oxnRlWMnZzJOB1m/5VQPO69DB+XjJlB9tZZYuP IZc5z3O38WDUSBJtEUU8z74Uxpvv/+lk6FIAdb+UO99KKzDPj9mdBBJicoWbhbjqlQrW 83FNYIfxrMpIIGwDbl+2obXjnmT5ScE9906d9FkA/ay1JkBf9tBPNmZvf7wHlt6ZrmPj 4QJyV/xnY7qHCizg3MhczJ1+OysQvj3Fxf1DJ1tviHznU5EIyWtVEPzDl3RwsdcTd6gH G5Nw== X-Gm-Message-State: ACrzQf2ILLmeue8cb5fdqUflhrjroBGUmJ2HbNA0uFpWM5B4Axu32LG/ 0FAESxc+RO3pNurEbDdNgoyb+/Xjq2aTTxPmALI= X-Google-Smtp-Source: AMsMyM73showvHxmEd9d0JjTLwwa6QsP8rOdvl6QUcuNE97biPaVTt01meiHVoBiMnWlo6h2aPJWDjN4xAkW9cpmTV4= X-Received: by 2002:a25:5089:0:b0:6ca:ba8:5e99 with SMTP id e131-20020a255089000000b006ca0ba85e99mr15448991ybb.40.1667276927745; Mon, 31 Oct 2022 21:28:47 -0700 (PDT) In-Reply-To: <835yg1hl9k.fsf@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: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246741 Archived-At: --00000000000005447905ec61298a Content-Type: text/plain; charset="UTF-8" On Sun, Oct 30, 2022 at 2:35 AM Eli Zaretskii wrote: > > From: Andrew Hyatt > > Date: Sat, 29 Oct 2022 19:44:17 -0400 > > Cc: 58850@debbugs.gnu.org > > > > > Some combination of sqlite and getting errors that result in > backtraces > > > seems to result in a problem. > > > > > > Relevant information from the crash report: > > > Thread 0 Crashed:: Dispatch queue: com.apple.main-thread > > > 0 libsystem_kernel.dylib 0x1aab6ed98 > __pthread_kill + 8 > > > 1 libsystem_pthread.dylib 0x1aaba3ee0 pthread_kill > + 288 > > > 2 libsystem_c.dylib 0x1aaade3cc __abort + 128 > > > 3 libsystem_c.dylib 0x1aaacfd48 > __stack_chk_fail + 96 > > > 4 Emacs 0x102dcdbd8 print_object > + 5920 > > > 5 Emacs 0x102dc9d50 Fprin1 + 112 > (print.c:775) > > > > Please try the latest master branch. Jonas installed changes there > > that are related to sqlite error handling, and with today's master I > > get a Lisp error with your recipe, not a crash: > > > > Debugger entered--Lisp error: (sqlite-error ("SQL logic error" "no > such table: bar" 1 1)) > > > > I've synced, rebuilt, verified Jonas's change is there, however the > crash still occurs. > > Then please walk through the code with a debugger and tell us what > kind of object is being created as result of the error that Emacs > cannot print via prin1 because print_object barfs. I cannot do it > here because the problem doesn't happen on my system in the first > place. > > The way to fix this is one of the following, whichever seems cleaner: > > . repair the object before it gets to the printing routines, > preferably where it is created; or > . add some protection to routines in print.c to stop short of trying > to look too closely at invalid Lisp objects > > Only debugging can tell which way is the best one here, but all things > being equal, I'd prefer the former. > Thanks for the advice. Right now, I narrowed the problem down to the sqlite connection name creation, since it is the printing of the sqlite object's name that causes the crash. The creation of the name is on sqlite.c line 269 ( https://git.savannah.gnu.org/cgit/emacs.git/tree/src/sqlite.c#n269). I can make the crash go away by substituting that line with my own filename: name = build_string("/tmp/test.db"); But I don't know what might be wrong with the line there as written. I'll continue to investigate, but it's possible that someone with better knowledge of the emacs internal idioms might spot the issue. --00000000000005447905ec61298a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sun, Oct 30, 2022 at 2:35 AM Eli Zaret= skii <eliz@gnu.org> wrote:
> From: Andrew Hyatt <ahyatt@gmail.com>
> Date: Sat, 29 Oct 2022 19:44:17 -0400
> Cc: 58850@d= ebbugs.gnu.org
>
>=C2=A0 > Some combination of sqlite and getting errors that result i= n backtraces
>=C2=A0 > seems to result in a problem.
>=C2=A0 >
>=C2=A0 > Relevant information from the crash report:
>=C2=A0 > Thread 0 Crashed::=C2=A0 Dispatch queue: com.apple.main-thr= ead
>=C2=A0 > 0=C2=A0 =C2=A0libsystem_kernel.dylib=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A00x1aab6ed98 __pthread_kill = + 8
>=C2=A0 > 1=C2=A0 =C2=A0libsystem_pthread.dylib=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x1aaba3ee0 pthread_kill + 288 >=C2=A0 > 2=C2=A0 =C2=A0libsystem_c.dylib=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x1aaade3cc __abort= + 128
>=C2=A0 > 3=C2=A0 =C2=A0libsystem_c.dylib=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x1aaacfd48 __stack= _chk_fail + 96
>=C2=A0 > 4=C2=A0 =C2=A0Emacs=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 0x102dcdbd8 print_object + 5920
>=C2=A0 > 5=C2=A0 =C2=A0Emacs=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 0x102dc9d50 Fprin1 + 112 (print.c:775)
>
>=C2=A0 Please try the latest master branch.=C2=A0 Jonas installed chang= es there
>=C2=A0 that are related to sqlite error handling, and with today's = master I
>=C2=A0 get a Lisp error with your recipe, not a crash:
>
>=C2=A0 =C2=A0 Debugger entered--Lisp error: (sqlite-error ("SQL lo= gic error" "no such table: bar" 1 1))
>
> I've synced, rebuilt, verified Jonas's change is there, howeve= r the crash still occurs.

Then please walk through the code with a debugger and tell us what
kind of object is being created as result of the error that Emacs
cannot print via prin1 because print_object barfs.=C2=A0 I cannot do it
here because the problem doesn't happen on my system in the first
place.

The way to fix this is one of the following, whichever seems cleaner:

=C2=A0 . repair the object before it gets to the printing routines,
=C2=A0 =C2=A0 preferably where it is created; or
=C2=A0 . add some protection to routines in print.c to stop short of trying=
=C2=A0 =C2=A0 to look too closely at invalid Lisp objects

Only debugging can tell which way is the best one here, but all things
being equal, I'd prefer the former.

Thanks for the advice.=C2=A0=C2=A0

Right now, I n= arrowed the problem down to the sqlite connection name creation, since it i= s the printing of the sqlite object's name that causes the crash.
=
The creation of the name is on sqlite.c line 269 (https://git.sava= nnah.gnu.org/cgit/emacs.git/tree/src/sqlite.c#n269).=C2=A0 I can make t= he crash go away by substituting that line with my own filename:=C2=A0 name= =3D build_string("/tmp/test.db");

But I= don't know what might be wrong with the line there as written.=C2=A0 I= 'll continue to investigate, but it's possible that someone with be= tter knowledge of the emacs internal idioms might spot the issue.

=C2=A0
--00000000000005447905ec61298a--