all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#58850: 29.0.50; sqlite crashes on error
@ 2022-10-29  0:47 Andrew Hyatt
  2022-10-29  7:40 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Hyatt @ 2022-10-29  0:47 UTC (permalink / raw)
  To: 58850

From emacs -Q, execute the following:


(defun will-fail ()
  (let ((db (sqlite-open (make-temp-file "will-fail"))))
    (sqlite-execute db "SELECT foo FROM bar;")))

(will-fail)

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)
6   Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
7   Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
8   Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
9   Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
10  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
11  Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
12  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
13  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
14  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
15  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
16  Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
17  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
18  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
19  Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
20  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
21  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
22  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
23  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
24  Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
25  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
26  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
27  Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
28  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
29  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
30  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
31  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
32  Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
33  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
34  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
35  Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
36  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
37  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
38  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
39  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
40  Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
41  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
42  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
43  Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
44  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
45  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
46  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
47  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
48  Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
49  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
50  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
51  Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
52  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
53  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
54  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
55  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
56  Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
57  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
58  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
59  Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
60  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
61  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
62  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
63  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
64  cl-print-79bf9fb1-c759fffb.eln	       0x16d40e14c F636c2d7072696e31_cl_prin1_0 + 460
65  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
66  backtrace-f58a28c5-349af640.eln	       0x2901c86a0 F6261636b74726163652d2d7072696e74_backtrace__print_0 + 268
67  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
68  cl-print-79bf9fb1-c759fffb.eln	       0x16d40e780 F636c2d7072696e742d746f2d737472696e672d776974682d6c696d6974_cl_print_to_string_with_limit_0 + 1216
69  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
70  backtrace-f58a28c5-349af640.eln	       0x2901c7594 F6261636b74726163652d2d7072696e742d746f2d737472696e67_backtrace__print_to_string_0 + 196
71  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
72  backtrace-f58a28c5-349af640.eln	       0x2901c8230 F6261636b74726163652d2d7072696e742d66756e632d616e642d61726773_backtrace__print_func_and_args_0 + 1820
73  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
74  backtrace-f58a28c5-349af640.eln	       0x2901c7800 F6261636b74726163652d7072696e742d6672616d65_backtrace_print_frame_0 + 240
75  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
76  backtrace-f58a28c5-349af640.eln	       0x2901c721c F6261636b74726163652d7072696e74_backtrace_print_0 + 476
77  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
78  debug-bee52b4d-57b75adc.eln   	       0x2901a6354 F64656275676765722d73657475702d627566666572_debugger_setup_buffer_0 + 596
79  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
80  debug-bee52b4d-57b75adc.eln   	       0x2901a5738 F6465627567_debug_0 + 1736
81  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
82  Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
83  ert-786c6677-22d9cf08.eln     	       0x2f8710554 F6572742d2d72756e2d746573742d6465627567676572_ert__run_test_debugger_0 + 992
84  Emacs                         	       0x102df0220 exec_byte_code + 3256 (bytecode.c:809)
85  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
86  Emacs                         	       0x102da8af4 Fapply + 708 (eval.c:2685)
87  Emacs                         	       0x102da2dbc apply1 + 20 (eval.c:2901) [inlined]
88  Emacs                         	       0x102da2dbc call_debugger + 456 (eval.c:338)
89  Emacs                         	       0x102da7810 maybe_call_debugger + 404 (eval.c:2040) [inlined]
90  Emacs                         	       0x102da7810 signal_or_quit + 1380 (eval.c:1811)
91  Emacs                         	       0x102e914c8 Fsignal + 36 (eval.c:1706)
92  Emacs                         	       0x102e914e8 xsignal + 12 (lisp.h:4552)
93  Emacs                         	       0x102e912c0 xsignal1 + 28
94  Emacs                         	       0x102e2db6c Fsqlite_execute + 416 (sqlite.c:435)
95  Emacs                         	       0x102da3c94 eval_sub + 2088 (eval.c:2523)
96  Emacs                         	       0x102daa130 Fprogn + 28 (eval.c:459) [inlined]
97  Emacs                         	       0x102daa130 funcall_lambda + 1428 (eval.c:3253)
98  Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
99  Emacs                         	       0x102db5514 call1 + 16 (lisp.h:3240) [inlined]
100 Emacs                         	       0x102db5514 mapcar1 + 352 (fns.c:2867)
101 Emacs                         	       0x102db5830 Fmapc + 92 (fns.c:2982)
102 Emacs                         	       0x102da3c80 eval_sub + 2068 (eval.c:2520)
103 Emacs                         	       0x102da5950 Fprogn + 28 (eval.c:459) [inlined]
104 Emacs                         	       0x102da5950 Flet + 1124 (eval.c:1049)
105 Emacs                         	       0x102da3bb4 eval_sub + 1864 (eval.c:2470)
106 Emacs                         	       0x102da3fd8 Fprogn + 28 (eval.c:459) [inlined]
107 Emacs                         	       0x102da3fd8 Fcond + 108 (eval.c:439)
108 Emacs                         	       0x102da3bb4 eval_sub + 1864 (eval.c:2470)
109 Emacs                         	       0x102da5270 Fprogn + 28 (eval.c:459) [inlined]
110 Emacs                         	       0x102da5270 FletX + 112 (eval.c:981)
111 Emacs                         	       0x102da3bb4 eval_sub + 1864 (eval.c:2470)
112 Emacs                         	       0x102daa130 Fprogn + 28 (eval.c:459) [inlined]
113 Emacs                         	       0x102daa130 funcall_lambda + 1428 (eval.c:3253)
114 Emacs                         	       0x102da8770 apply_lambda + 368 (eval.c:3123)
115 Emacs                         	       0x102da394c eval_sub + 1248
116 Emacs                         	       0x102daa130 Fprogn + 28 (eval.c:459) [inlined]
117 Emacs                         	       0x102daa130 funcall_lambda + 1428 (eval.c:3253)
118 Emacs                         	       0x102da8770 apply_lambda + 368 (eval.c:3123)
119 Emacs                         	       0x102da394c eval_sub + 1248
120 Emacs                         	       0x102da5950 Fprogn + 28 (eval.c:459) [inlined]
121 Emacs                         	       0x102da5950 Flet + 1124 (eval.c:1049)
122 Emacs                         	       0x102da3bb4 eval_sub + 1864 (eval.c:2470)
123 Emacs                         	       0x102da3f50 Fprogn + 48 (eval.c:459)
124 Emacs                         	       0x102da3bb4 eval_sub + 1864 (eval.c:2470)
125 Emacs                         	       0x102da6794 Funwind_protect + 260 (eval.c:1324)
126 Emacs                         	       0x102da3bb4 eval_sub + 1864 (eval.c:2470)
127 Emacs                         	       0x102da5950 Fprogn + 28 (eval.c:459) [inlined]
128 Emacs                         	       0x102da5950 Flet + 1124 (eval.c:1049)
129 Emacs                         	       0x102da3bb4 eval_sub + 1864 (eval.c:2470)
130 Emacs                         	       0x102daa130 Fprogn + 28 (eval.c:459) [inlined]
131 Emacs                         	       0x102daa130 funcall_lambda + 1428 (eval.c:3253)
132 Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
133 ert-786c6677-22d9cf08.eln     	       0x2f8711430 F6572742d2d72756e2d746573742d696e7465726e616c_ert__run_test_internal_0 + 1072
134 Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
135 ert-786c6677-22d9cf08.eln     	       0x2f871203c F6572742d72756e2d74657374_ert_run_test_0 + 924
136 Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
137 ert-786c6677-22d9cf08.eln     	       0x2f8719528 F6572742d72756e2d6f722d726572756e2d74657374_ert_run_or_rerun_test_0 + 472
138 Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
139 ert-786c6677-22d9cf08.eln     	       0x2f87268e0 F6572742d726573756c74732d726572756e2d746573742d61742d706f696e74_ert_results_rerun_test_at_point_0 + 624
140 Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
141 ert-786c6677-22d9cf08.eln     	       0x2f8726c0c F6572742d726573756c74732d726572756e2d746573742d61742d706f696e742d646562756767696e672d6572726f7273_ert_results_rerun_test_at_point_debugging_errors_0 + 72
142 Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
143 Emacs                         	       0x102da110c Ffuncall_interactively + 68 (callint.c:248)
144 Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
145 Emacs                         	       0x102da2620 Fcall_interactively + 5372 (callint.c:340)
146 simple-fab5b0cf-ef411e81.eln  	       0x1070ffd04 F636f6d6d616e642d65786563757465_command_execute_0 + 804
147 Emacs                         	       0x102da5ef0 Ffuncall + 340 (eval.c:3014)
148 Emacs                         	       0x102d18f50 call1 + 20 (lisp.h:3240) [inlined]
149 Emacs                         	       0x102d18f50 command_loop_1 + 1380 (keyboard.c:1505)
150 Emacs                         	       0x102da6d8c internal_condition_case + 96 (eval.c:1497)
151 Emacs                         	       0x102d189d8 command_loop_2 + 52 (keyboard.c:1132)
152 Emacs                         	       0x102da6668 internal_catch + 88 (eval.c:1220)
153 Emacs                         	       0x102e8f370 recursive_edit_1.cold.1 + 80 (keyboard.c:1110)
154 Emacs                         	       0x102d18214 command_loop + 4 (keyboard.c:1107) [inlined]
155 Emacs                         	       0x102d18214 recursive_edit_1 + 372 (keyboard.c:719)
156 Emacs                         	       0x102d183a4 Frecursive_edit + 364 (keyboard.c:802)
157 Emacs                         	       0x102d176bc main + 9504 (emacs.c:2517)
158 dyld                          	       0x10382508c start + 520



In GNU Emacs 29.0.50 (build 1, aarch64-apple-darwin21.6.0, NS
appkit-2113.60 Version 12.6 (Build 21G115)) of 2022-10-27 built on
andrews-mbp.lan
Repository revision: 41d3d71a1e6709a7357c1c7aeae4f49cd65fb602
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2113
System Description:  macOS 12.6

Configured using:
'configure --with-native-compilation'

Configured features:
ACL GLIB GNUTLS JSON LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY KQUEUE NS
PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS WEBP XIM ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  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 time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils thingatpt
cl-loaddefs comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv
cl-extra help-mode bytecomp byte-compile cl-lib rmc iso-transl tooltip
cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win 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 kqueue cocoa ns lcms2 multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 76683 8826)
(symbols 48 7038 0)
(strings 32 19326 3490)
(string-bytes 1 619213)
(vectors 16 16738)
(vector-slots 8 333256 10135)
(floats 8 28 47)
(intervals 56 236 0)
(buffers 1000 12))





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#58850: 29.0.50; sqlite crashes on error
  2022-10-29  0:47 bug#58850: 29.0.50; sqlite crashes on error Andrew Hyatt
@ 2022-10-29  7:40 ` Eli Zaretskii
  2022-10-29 23:44   ` Andrew Hyatt
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2022-10-29  7:40 UTC (permalink / raw)
  To: Andrew Hyatt; +Cc: 58850

> From: Andrew Hyatt <ahyatt@gmail.com>
> Date: Fri, 28 Oct 2022 20:47:05 -0400
> 
> From emacs -Q, execute the following:
> 
> 
> (defun will-fail ()
>   (let ((db (sqlite-open (make-temp-file "will-fail"))))
>     (sqlite-execute db "SELECT foo FROM bar;")))
> 
> (will-fail)
> 
> 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))





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#58850: 29.0.50; sqlite crashes on error
  2022-10-29  7:40 ` Eli Zaretskii
@ 2022-10-29 23:44   ` Andrew Hyatt
  2022-10-30  6:35     ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Hyatt @ 2022-10-29 23:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 58850

[-- Attachment #1: Type: text/plain, Size: 1472 bytes --]

On Sat, Oct 29, 2022 at 3:40 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Andrew Hyatt <ahyatt@gmail.com>
> > Date: Fri, 28 Oct 2022 20:47:05 -0400
> >
> > From emacs -Q, execute the following:
> >
> >
> > (defun will-fail ()
> >   (let ((db (sqlite-open (make-temp-file "will-fail"))))
> >     (sqlite-execute db "SELECT foo FROM bar;")))
> >
> > (will-fail)
> >
> > 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.

[-- Attachment #2: Type: text/html, Size: 2148 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#58850: 29.0.50; sqlite crashes on error
  2022-10-29 23:44   ` Andrew Hyatt
@ 2022-10-30  6:35     ` Eli Zaretskii
  2022-11-01  4:28       ` Andrew Hyatt
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2022-10-30  6:35 UTC (permalink / raw)
  To: Andrew Hyatt; +Cc: 58850

> From: Andrew Hyatt <ahyatt@gmail.com>
> 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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#58850: 29.0.50; sqlite crashes on error
  2022-10-30  6:35     ` Eli Zaretskii
@ 2022-11-01  4:28       ` Andrew Hyatt
  2022-11-01  7:45         ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Hyatt @ 2022-11-01  4:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 58850

[-- Attachment #1: Type: text/plain, Size: 2673 bytes --]

On Sun, Oct 30, 2022 at 2:35 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Andrew Hyatt <ahyatt@gmail.com>
> > 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.

[-- Attachment #2: Type: text/html, Size: 3632 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#58850: 29.0.50; sqlite crashes on error
  2022-11-01  4:28       ` Andrew Hyatt
@ 2022-11-01  7:45         ` Eli Zaretskii
  2022-11-01  9:03           ` Gerd Möllmann
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2022-11-01  7:45 UTC (permalink / raw)
  To: Andrew Hyatt; +Cc: 58850

> From: Andrew Hyatt <ahyatt@gmail.com>
> Date: Tue, 1 Nov 2022 00:28:36 -0400
> Cc: 58850@debbugs.gnu.org
> 
> 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.

This is not at all clear from the backtrace you posted; see below.

> 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");

That line just encodes the file name.  I have hard time believing it
could cause a problem like this.  What do you see in the value of
'name' after line 269 is executed?

For starters, please rebuild Emacs without optimizations and with
"--enable-checking=yes" at configure time, and then post a full
backtrace when running the recipe you posted.  The original backtrace
you posted seems to come from an optimized build (so line numbers
don't tell the whole story), and includes multiple references to ERT
functions, from which I conclude it was not obtained by running the
recipe, but by running something much more complex.

Armed with the accurate backtrace, we might have a different picture
of what causes this problem.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#58850: 29.0.50; sqlite crashes on error
  2022-11-01  7:45         ` Eli Zaretskii
@ 2022-11-01  9:03           ` Gerd Möllmann
  2022-11-01  9:16             ` Gerd Möllmann
  0 siblings, 1 reply; 10+ messages in thread
From: Gerd Möllmann @ 2022-11-01  9:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 58850, Andrew Hyatt

Eli Zaretskii <eliz@gnu.org> writes:

> Armed with the accurate backtrace, we might have a different picture
> of what causes this problem.

Since I have debug build at hand, here is the result:

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = Stack buffer overflow
  * frame #0: 0x0000000103759334 libclang_rt.asan_osx_dynamic.dylib`__asan::AsanDie()
    frame #1: 0x0000000103771870 libclang_rt.asan_osx_dynamic.dylib`__sanitizer::Die() + 192
    frame #2: 0x00000001037571c0 libclang_rt.asan_osx_dynamic.dylib`__asan::ScopedInErrorReport::~ScopedInErrorReport() + 1124
    frame #3: 0x0000000103756498 libclang_rt.asan_osx_dynamic.dylib`__asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) + 1436
    frame #4: 0x0000000103727964 libclang_rt.asan_osx_dynamic.dylib`wrap_memcpy + 616
    frame #5: 0x000000019189acbc libsystem_c.dylib`__sfvwrite + 324
    frame #6: 0x0000000191899988 libsystem_c.dylib`__vfprintf + 7200
    frame #7: 0x00000001918a31cc libsystem_c.dylib`vsprintf_l + 204
    frame #8: 0x000000010372db70 libclang_rt.asan_osx_dynamic.dylib`wrap_vsprintf + 184
    frame #9: 0x000000010372e148 libclang_rt.asan_osx_dynamic.dylib`wrap_sprintf + 84
    frame #10: 0x00000001008276ec emacs`print_vectorlike(obj=(struct Lisp_Sqlite *) $5 = 0x0000000117d4ccd8, printcharfun=(struct Lisp_Symbol *) $8 = 0x0000000101494c00, escapeflag=true, buf=" name=0dd48080") at print.c:2020:6
    frame #11: 0x00000001008228f0 emacs`print_object(obj=(struct Lisp_Sqlite *) $13 = 0x0000000117d4ccd8, printcharfun=(struct Lisp_Symbol *) $16 = 0x0000000101494c00, escapeflag=true) at print.c:2569:11
    frame #12: 0x0000000100812f3c emacs`print(obj=(struct Lisp_Sqlite *) $21 = 0x0000000117d4ccd8, printcharfun=(struct Lisp_Symbol *) $24 = 0x0000000101494c00, escapeflag=true) at print.c:1298:3
    frame #13: 0x00000001008121fc emacs`Fprin1(object=(struct Lisp_Sqlite *) $29 = 0x0000000117d4ccd8, printcharfun=(struct buffer *) $34 = 0x0000000121142d20, overrides=(struct Lisp_Symbol *) $37 = 0x0000000101494c00) at print.c:773:3
    frame #14: 0x0000000100780668 emacs`funcall_subr(subr=0x0000000100d15040, numargs=2, args=(struct Lisp_Symbol *) $40 = 0x0000000101494c00) at eval.c:3026:15
    frame #15: 0x00000001008918cc emacs`exec_byte_code(fun=(struct Lisp_Vector *) $45 = 0x0000000117d482d0, args_template=514, nargs=2, args=(struct Lisp_Symbol *) $48 = 0x0000000101494c00) at bytecode.c:809:14
    frame #16: 0x000000010078c740 emacs`fetch_and_exec_byte_code(fun=(struct Lisp_Vector *) $53 = 0x0000000117d482d0, args_template=514, nargs=2, args=(struct Lisp_Symbol *) $56 = 0x0000000101494c00) at eval.c:3069:10
    frame #17: 0x0000000100781a4c emacs`funcall_lambda(fun=(struct Lisp_Vector *) $61 = 0x0000000117d482d0, nargs=2, arg_vector=(struct Lisp_Symbol *) $64 = 0x0000000101494c00) at eval.c:3141:9
    frame #18: 0x000000010077fb08 emacs`funcall_general(fun=(struct Lisp_Vector *) $69 = 0x0000000117d482d0, numargs=2, args=(struct Lisp_Symbol *) $72 = 0x0000000101494c00) at eval.c:2933:12
    frame #19: 0x00000001007717cc emacs`Ffuncall(nargs=3, args=(struct Lisp_Symbol *) $75 = 0x0000000101494c00) at eval.c:2983:21
    frame #20: 0x000000010077dff4 emacs`Fapply(nargs=2, args=(struct Lisp_Symbol *) $78 = 0x0000000101494c00) at eval.c:2654:24
    frame #21: 0x0000000100781090 emacs`funcall_subr(subr=0x0000000100d110e0, numargs=2, args=(struct Lisp_Symbol *) $81 = 0x0000000101494c00) at eval.c:3047:9
    frame #22: 0x00000001008918cc emacs`exec_byte_code(fun=(struct Lisp_Vector *) $86 = 0x0000000121143240, args_template=128, nargs=0, args=(struct Lisp_Symbol *) $89 = 0x0000000101494c00) at bytecode.c:809:14
    frame #23: 0x000000010078c740 emacs`fetch_and_exec_byte_code(fun=(struct Lisp_Vector *) $94 = 0x000000011dc591f0, args_template=771, nargs=3, args=(struct Lisp_Symbol *) $97 = 0x0000000101494c00) at eval.c:3069:10
    frame #24: 0x0000000100781a4c emacs`funcall_lambda(fun=(struct Lisp_Vector *) $102 = 0x000000011dc591f0, nargs=3, arg_vector=(struct Lisp_Symbol *) $105 = 0x0000000101494c00) at eval.c:3141:9
    frame #25: 0x000000010077fb08 emacs`funcall_general(fun=(struct Lisp_Vector *) $110 = 0x000000011dc591f0, numargs=3, args=(struct Lisp_Symbol *) $113 = 0x0000000101494c00) at eval.c:2933:12
    frame #26: 0x00000001007717cc emacs`Ffuncall(nargs=4, args=(struct Lisp_Symbol *) $116 = 0x0000000101494c00) at eval.c:2983:21
    frame #27: 0x000000010077dff4 emacs`Fapply(nargs=3, args=(struct Lisp_Symbol *) $119 = 0x0000000101494c00) at eval.c:2654:24
    frame #28: 0x0000000100781090 emacs`funcall_subr(subr=0x0000000100d110e0, numargs=3, args=(struct Lisp_Symbol *) $122 = 0x0000000101494c00) at eval.c:3047:9
    frame #29: 0x00000001008918cc emacs`exec_byte_code(fun=(struct Lisp_Vector *) $127 = 0x0000000121132f20, args_template=128, nargs=2, args=(struct Lisp_Symbol *) $130 = 0x0000000101494c00) at bytecode.c:809:14
    frame #30: 0x000000010078c740 emacs`fetch_and_exec_byte_code(fun=(struct Lisp_Vector *) $135 = 0x0000000121132f20, args_template=128, nargs=2, args=(struct Lisp_Symbol *) $138 = 0x0000000101494c00) at eval.c:3069:10
    frame #31: 0x0000000100781a4c emacs`funcall_lambda(fun=(struct Lisp_Vector *) $143 = 0x0000000121132f20, nargs=2, arg_vector=(struct Lisp_Symbol *) $146 = 0x0000000101494c00) at eval.c:3141:9
    frame #32: 0x000000010077fb08 emacs`funcall_general(fun=(struct Lisp_Vector *) $151 = 0x0000000121132f20, numargs=2, args=(struct Lisp_Symbol *) $154 = 0x0000000101494c00) at eval.c:2933:12
    frame #33: 0x00000001007717cc emacs`Ffuncall(nargs=3, args=(struct Lisp_Symbol *) $157 = 0x0000000101494c00) at eval.c:2983:21
    frame #34: 0x000000010077cf8c emacs`Fapply(nargs=3, args=(struct Lisp_Symbol *) $160 = 0x0000000101494c00) at eval.c:2611:14
    frame #35: 0x0000000100781090 emacs`funcall_subr(subr=0x0000000100d110e0, numargs=3, args=(struct Lisp_Symbol *) $163 = 0x0000000101494c00) at eval.c:3047:9
    frame #36: 0x00000001008918cc emacs`exec_byte_code(fun=(struct Lisp_Vector *) $168 = 0x0000000107a49488, args_template=514, nargs=2, args=(struct Lisp_Symbol *) $171 = 0x0000000101494c00) at bytecode.c:809:14
    frame #37: 0x000000010078c740 emacs`fetch_and_exec_byte_code(fun=(struct Lisp_Vector *) $176 = 0x0000000117d48330, args_template=514, nargs=2, args=(struct Lisp_Symbol *) $179 = 0x0000000101494c00) at eval.c:3069:10
    frame #38: 0x0000000100781a4c emacs`funcall_lambda(fun=(struct Lisp_Vector *) $184 = 0x0000000117d48330, nargs=2, arg_vector=(struct Lisp_Symbol *) $187 = 0x0000000101494c00) at eval.c:3141:9
    frame #39: 0x000000010077fb08 emacs`funcall_general(fun=(struct Lisp_Vector *) $192 = 0x0000000117d48330, numargs=2, args=(struct Lisp_Symbol *) $195 = 0x0000000101494c00) at eval.c:2933:12
    frame #40: 0x00000001007717cc emacs`Ffuncall(nargs=3, args=(struct Lisp_Symbol *) $198 = 0x0000000101494c00) at eval.c:2983:21
    frame #41: 0x000000010077dff4 emacs`Fapply(nargs=2, args=(struct Lisp_Symbol *) $201 = 0x0000000101494c00) at eval.c:2654:24
    frame #42: 0x0000000100781090 emacs`funcall_subr(subr=0x0000000100d110e0, numargs=2, args=(struct Lisp_Symbol *) $204 = 0x0000000101494c00) at eval.c:3047:9
    frame #43: 0x00000001008918cc emacs`exec_byte_code(fun=(struct Lisp_Vector *) $209 = 0x0000000121143190, args_template=128, nargs=0, args=(struct Lisp_Symbol *) $212 = 0x0000000101494c00) at bytecode.c:809:14
    frame #44: 0x000000010078c740 emacs`fetch_and_exec_byte_code(fun=(struct Lisp_Vector *) $217 = 0x000000011dc591f0, args_template=771, nargs=3, args=(struct Lisp_Symbol *) $220 = 0x0000000101494c00) at eval.c:3069:10
    frame #45: 0x0000000100781a4c emacs`funcall_lambda(fun=(struct Lisp_Vector *) $225 = 0x000000011dc591f0, nargs=3, arg_vector=(struct Lisp_Symbol *) $228 = 0x0000000101494c00) at eval.c:3141:9
    frame #46: 0x000000010077fb08 emacs`funcall_general(fun=(struct Lisp_Vector *) $233 = 0x000000011dc591f0, numargs=3, args=(struct Lisp_Symbol *) $236 = 0x0000000101494c00) at eval.c:2933:12
    frame #47: 0x00000001007717cc emacs`Ffuncall(nargs=4, args=(struct Lisp_Symbol *) $239 = 0x0000000101494c00) at eval.c:2983:21
    frame #48: 0x000000010077dff4 emacs`Fapply(nargs=3, args=(struct Lisp_Symbol *) $242 = 0x0000000101494c00) at eval.c:2654:24
    frame #49: 0x0000000100781090 emacs`funcall_subr(subr=0x0000000100d110e0, numargs=3, args=(struct Lisp_Symbol *) $245 = 0x0000000101494c00) at eval.c:3047:9
    frame #50: 0x00000001008918cc emacs`exec_byte_code(fun=(struct Lisp_Vector *) $250 = 0x0000000121132e00, args_template=128, nargs=2, args=(struct Lisp_Symbol *) $253 = 0x0000000101494c00) at bytecode.c:809:14
    frame #51: 0x000000010078c740 emacs`fetch_and_exec_byte_code(fun=(struct Lisp_Vector *) $258 = 0x0000000121132e00, args_template=128, nargs=2, args=(struct Lisp_Symbol *) $261 = 0x0000000101494c00) at eval.c:3069:10
    frame #52: 0x0000000100781a4c emacs`funcall_lambda(fun=(struct Lisp_Vector *) $266 = 0x0000000121132e00, nargs=2, arg_vector=(struct Lisp_Symbol *) $269 = 0x0000000101494c00) at eval.c:3141:9
    frame #53: 0x000000010077fb08 emacs`funcall_general(fun=(struct Lisp_Vector *) $274 = 0x0000000121132e00, numargs=2, args=(struct Lisp_Symbol *) $277 = 0x0000000101494c00) at eval.c:2933:12
    frame #54: 0x00000001007717cc emacs`Ffuncall(nargs=3, args=(struct Lisp_Symbol *) $280 = 0x0000000101494c00) at eval.c:2983:21
    frame #55: 0x000000010077cf8c emacs`Fapply(nargs=3, args=(struct Lisp_Symbol *) $283 = 0x0000000101494c00) at eval.c:2611:14
    frame #56: 0x0000000100781090 emacs`funcall_subr(subr=0x0000000100d110e0, numargs=3, args=(struct Lisp_Symbol *) $286 = 0x0000000101494c00) at eval.c:3047:9
    frame #57: 0x00000001008918cc emacs`exec_byte_code(fun=(struct Lisp_Vector *) $291 = 0x000000010752ec50, args_template=257, nargs=1, args=(struct Lisp_Symbol *) $294 = 0x0000000101494c00) at bytecode.c:809:14
    frame #58: 0x000000010078c740 emacs`fetch_and_exec_byte_code(fun=(struct Lisp_Vector *) $299 = 0x0000000111116b30, args_template=128, nargs=2, args=(struct Lisp_Symbol *) $302 = 0x0000000101494c00) at eval.c:3069:10
    frame #59: 0x0000000100781a4c emacs`funcall_lambda(fun=(struct Lisp_Vector *) $307 = 0x0000000111116b30, nargs=2, arg_vector=(struct Lisp_Symbol *) $310 = 0x0000000101494c00) at eval.c:3141:9
    frame #60: 0x000000010077fb08 emacs`funcall_general(fun=(struct Lisp_Vector *) $315 = 0x0000000111116b30, numargs=2, args=(struct Lisp_Symbol *) $318 = 0x0000000101494c00) at eval.c:2933:12
    frame #61: 0x00000001007717cc emacs`Ffuncall(nargs=3, args=(struct Lisp_Symbol *) $321 = 0x0000000101494c00) at eval.c:2983:21
    frame #62: 0x000000010077dff4 emacs`Fapply(nargs=2, args=(struct Lisp_Symbol *) $324 = 0x0000000101494c00) at eval.c:2654:24
    frame #63: 0x00000001007645a8 emacs`apply1(fn=(struct Lisp_Symbol *) $327 = 0x0000000101499dc0, arg=(struct Lisp_Cons *) $329 = 0x00000001074cd700) at eval.c:2870:43
    frame #64: 0x0000000100762c8c emacs`call_debugger(arg=(struct Lisp_Cons *) $331 = 0x00000001074cd700) at eval.c:315:9
    frame #65: 0x000000010078b91c emacs`maybe_call_debugger(conditions=(struct Lisp_Cons *) $333 = 0x00000001076b6390, sig=(struct Lisp_Symbol *) $336 = 0x00000001014a2d60, data=(struct Lisp_Cons *) $338 = 0x00000001074cd6d0) at eval.c:2014:7
    frame #66: 0x000000010077787c emacs`signal_or_quit(error_symbol=(struct Lisp_Symbol *) $341 = 0x00000001014a2d60, data=(struct Lisp_Cons *) $343 = 0x00000001074cd6d0, keyboard_quit=false) at eval.c:1789:4
    frame #67: 0x0000000100b92b84 emacs`Fsignal(error_symbol=(struct Lisp_Symbol *) $346 = 0x00000001014a2d60, data=(struct Lisp_Cons *) $348 = 0x00000001074cd6d0) at eval.c:1685:3
    frame #68: 0x0000000100b92c60 emacs`xsignal(error_symbol=(struct Lisp_Symbol *) $351 = 0x00000001014a2d60, data=(struct Lisp_Cons *) $353 = 0x00000001074cd6d0) at lisp.h:4553:3
    frame #69: 0x0000000100b92150 emacs`xsignal1(error_symbol=(struct Lisp_Symbol *) $356 = 0x00000001014a2d60, arg=(struct Lisp_Cons *) $358 = 0x00000001074cd6c0) at eval.c:1879:3
    frame #70: 0x00000001009a0330 emacs`Fsqlite_execute(db=(struct Lisp_Sqlite *) $363 = 0x0000000117d4ccd8, query=(struct Lisp_String *) $365 = 0x000000011aa11ea0, values=(struct Lisp_Symbol *) $368 = 0x0000000101494c00) at sqlite.c:510:3
    frame #71: 0x0000000100766ff0 emacs`eval_sub(form=(struct Lisp_Cons *) $370 = 0x00000001074766e0) at eval.c:2492:15
    frame #72: 0x0000000100768a88 emacs`Fprogn(body=(struct Lisp_Symbol *) $373 = 0x0000000101494c00) at eval.c:436:13
    frame #73: 0x0000000100770124 emacs`Flet(args=(struct Lisp_Cons *) $375 = 0x00000001074766d0) at eval.c:1026:9
    frame #74: 0x00000001007663f4 emacs`eval_sub(form=(struct Lisp_Cons *) $377 = 0x0000000107476650) at eval.c:2437:8
    frame #75: 0x0000000100768a88 emacs`Fprogn(body=(struct Lisp_Symbol *) $380 = 0x0000000101494c00) at eval.c:436:13
    frame #76: 0x00000001007823a4 emacs`funcall_lambda(fun=(struct Lisp_Cons *) $382 = 0x0000000107475a00, nargs=0, arg_vector=(struct Lisp_Symbol *) $385 = 0x0000000101494c00) at eval.c:3221:11
    frame #77: 0x000000010077c9c8 emacs`apply_lambda(fun=(struct Lisp_Cons *) $387 = 0x0000000107475a10, args=(struct Lisp_Symbol *) $390 = 0x0000000101494c00, count=(bytes = 544)) at eval.c:3091:9
    frame #78: 0x0000000100767f90 emacs`eval_sub(form=(struct Lisp_Cons *) $392 = 0x00000001074cd5f0) at eval.c:2576:9
    frame #79: 0x0000000100768a88 emacs`Fprogn(body=(struct Lisp_Symbol *) $395 = 0x0000000101494c00) at eval.c:436:13
    frame #80: 0x00000001007663f4 emacs`eval_sub(form=(struct Lisp_Cons *) $397 = 0x00000001074cd610) at eval.c:2437:8
    frame #81: 0x000000010077ab44 emacs`Feval(form=(struct Lisp_Cons *) $399 = 0x00000001074cd610, lexical=(struct Lisp_Symbol *) $402 = 0x0000000101494c30) at eval.c:2349:28
    frame #82: 0x0000000100780560 emacs`funcall_subr(subr=0x0000000100d11080, numargs=2, args=(struct Lisp_Symbol *) $405 = 0x0000000101494c00) at eval.c:3024:15
    frame #83: 0x00000001008918cc emacs`exec_byte_code(fun=(struct Lisp_Vector *) $410 = 0x000000010760e440, args_template=513, nargs=2, args=(struct Lisp_Symbol *) $413 = 0x0000000101494c00) at bytecode.c:809:14
    frame #84: 0x000000010078c740 emacs`fetch_and_exec_byte_code(fun=(struct Lisp_Vector *) $418 = 0x00000001079d2418, args_template=256, nargs=1, args=(struct Lisp_Symbol *) $421 = 0x0000000101494c00) at eval.c:3069:10
    frame #85: 0x0000000100781a4c emacs`funcall_lambda(fun=(struct Lisp_Vector *) $426 = 0x00000001079d2418, nargs=1, arg_vector=(struct Lisp_Symbol *) $429 = 0x0000000101494c00) at eval.c:3141:9
    frame #86: 0x000000010077fb08 emacs`funcall_general(fun=(struct Lisp_Vector *) $434 = 0x00000001079d2418, numargs=1, args=(struct Lisp_Symbol *) $437 = 0x0000000101494c00) at eval.c:2933:12
    frame #87: 0x00000001007717cc emacs`Ffuncall(nargs=2, args=(struct Lisp_Symbol *) $440 = 0x0000000101494c00) at eval.c:2983:21
    frame #88: 0x0000000100756c78 emacs`Ffuncall_interactively(nargs=2, args=(struct Lisp_Symbol *) $443 = 0x0000000101494c00) at callint.c:248:32
    frame #89: 0x0000000100781090 emacs`funcall_subr(subr=0x0000000100d10420, numargs=2, args=(struct Lisp_Symbol *) $446 = 0x0000000101494c00) at eval.c:3047:9
    frame #90: 0x000000010077fab8 emacs`funcall_general(fun=(struct Lisp_Subr *) $451 = 0x0000000100d10420, numargs=2, args=(struct Lisp_Symbol *) $454 = 0x0000000101494c00) at eval.c:2929:12
    frame #91: 0x00000001007717cc emacs`Ffuncall(nargs=3, args=(struct Lisp_Symbol *) $457 = 0x0000000101494c00) at eval.c:2983:21
    frame #92: 0x000000010075c48c emacs`Fcall_interactively(function=(struct Lisp_Symbol *) $460 = 0x00000001079d23e8, record_flag=(struct Lisp_Symbol *) $463 = 0x0000000101494c00, keys=(struct Lisp_Vector *) $467 = 0x0000000107fd7c28) at callint.c:785:21
    frame #93: 0x0000000100780668 emacs`funcall_subr(subr=0x0000000100d103c0, numargs=3, args=(struct Lisp_Symbol *) $470 = 0x0000000101494c00) at eval.c:3026:15
    frame #94: 0x00000001008918cc emacs`exec_byte_code(fun=(struct Lisp_Vector *) $475 = 0x00000001075c5d38, args_template=1025, nargs=1, args=(struct Lisp_Symbol *) $478 = 0x0000000101494c00) at bytecode.c:809:14
    frame #95: 0x000000010078c740 emacs`fetch_and_exec_byte_code(fun=(struct Lisp_Vector *) $483 = 0x00000001075c5d38, args_template=1025, nargs=1, args=(struct Lisp_Symbol *) $486 = 0x0000000101494c00) at eval.c:3069:10
    frame #96: 0x0000000100781a4c emacs`funcall_lambda(fun=(struct Lisp_Vector *) $491 = 0x00000001075c5d38, nargs=1, arg_vector=(struct Lisp_Symbol *) $494 = 0x0000000101494c00) at eval.c:3141:9
    frame #97: 0x000000010077fb08 emacs`funcall_general(fun=(struct Lisp_Vector *) $499 = 0x00000001075c5d38, numargs=1, args=(struct Lisp_Symbol *) $502 = 0x0000000101494c00) at eval.c:2933:12
    frame #98: 0x00000001007717cc emacs`Ffuncall(nargs=2, args=(struct Lisp_Symbol *) $505 = 0x0000000101494c00) at eval.c:2983:21
    frame #99: 0x00000001004d6448 emacs`call1(fn=(struct Lisp_Symbol *) $508 = 0x0000000101499250, arg1=(struct Lisp_Symbol *) $511 = 0x00000001079d23e8) at lisp.h:3242:10
    frame #100: 0x00000001004ca430 emacs`command_loop_1 at keyboard.c:1493:13
    frame #101: 0x0000000100774d0c emacs`internal_condition_case(bfun=(emacs`command_loop_1 at keyboard.c:1268), handlers=(struct Lisp_Symbol *) $514 = 0x0000000101494c90, hfun=(emacs`cmd_error at keyboard.c:926)) at eval.c:1474:25
    frame #102: 0x00000001004c887c emacs`command_loop_2(handlers=(struct Lisp_Symbol *) $517 = 0x0000000101494c90) at keyboard.c:1123:11
    frame #103: 0x0000000100772804 emacs`internal_catch(tag=(struct Lisp_Symbol *) $520 = 0x00000001014a3c90, func=(emacs`command_loop_2 at keyboard.c:1119), arg=(struct Lisp_Symbol *) $523 = 0x0000000101494c90) at eval.c:1197:25
    frame #104: 0x00000001004c61a0 emacs`command_loop at keyboard.c:1101:2
    frame #105: 0x00000001004c5c08 emacs`recursive_edit_1 at keyboard.c:710:9
    frame #106: 0x00000001004c6d34 emacs`Frecursive_edit at keyboard.c:793:3
    frame #107: 0x00000001004be3c0 emacs`main(argc=2, argv=0x000000016fdff650) at emacs.c:2515:3
    frame #108: 0x00000001916abe50 dyld`start + 2544

(lldb) f 10
frame #10: 0x00000001008276ec emacs`print_vectorlike(obj=(struct Lisp_Sqlite *) $528 = 0x0000000117d4ccd8, printcharfun=(struct Lisp_Symbol *) $531 = 0x0000000101494c00, escapeflag=true, buf=" name=0dd48080") at print.c:2020:6
   2017		    i = sprintf (buf, " stmt=%p", XSQLITE (obj)->stmt);
   2018		    strout (buf, i, i, printcharfun);
   2019		  }
-> 2020		i = sprintf (buf, " name=%s", XSQLITE (obj)->name);
   2021		strout (buf, i, i, printcharfun);
   2022		printchar ('>', printcharfun);
   2023	      }

(lldb) p obj
(Lisp_Object) $532 = 0x0000000117d4ccdd (struct Lisp_Sqlite *) $537 = 0x0000000117d4ccd8
(lldb) p *$537
(struct Lisp_Sqlite) $538 = {
  header = (size = 4611686018863616000)
  db = 0x000000010dd48080
  stmt = 0x0000000000000000
  name = 0x0000000120c131f0 "/var/folders/1d/k_6t25f94sl83szqbf8gpkrh0000gn/T/will-failVznhDE"
  finalizer = 0x00000001009a2bf4 (emacs`sqlite_free at sqlite.c:201)
  eof = false
  is_statement = false
}

buf comes from print_object

  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)))];

which I find quite funny :-).

I haven't taken a close look, but I know that reading symbols goes so
great lengths of growing its buffer as needed.  Maybe this is missing in
this case.  Or something similar.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#58850: 29.0.50; sqlite crashes on error
  2022-11-01  9:03           ` Gerd Möllmann
@ 2022-11-01  9:16             ` Gerd Möllmann
  2022-11-02  3:33               ` Andrew Hyatt
  0 siblings, 1 reply; 10+ messages in thread
From: Gerd Möllmann @ 2022-11-01  9:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 58850, Andrew Hyatt

Gerd Möllmann <gerd.moellmann@gmail.com> writes:

> I haven't taken a close look, but I know that reading symbols goes so
> great lengths of growing its buffer as needed.  Maybe this is missing in
> this case.  Or something similar.

I've pushed a fix to master.  Could you please check, Andrew?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#58850: 29.0.50; sqlite crashes on error
  2022-11-01  9:16             ` Gerd Möllmann
@ 2022-11-02  3:33               ` Andrew Hyatt
  2022-11-02  5:00                 ` Gerd Möllmann
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Hyatt @ 2022-11-02  3:33 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: 58850, Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 691 bytes --]

On Tue, Nov 1, 2022 at 5:16 AM Gerd Möllmann <gerd.moellmann@gmail.com>
wrote:

> Gerd Möllmann <gerd.moellmann@gmail.com> writes:
>
> > I haven't taken a close look, but I know that reading symbols goes so
> > great lengths of growing its buffer as needed.  Maybe this is missing in
> > this case.  Or something similar.
>
> I've pushed a fix to master.  Could you please check, Andrew?
>

It does work for me, thank you for the fix!  I don't think I really
understand what is going on here either (does anyone? is the length of the
path in the name the relevant thing here?), but if there's a solution that
works, then that's enough for me, thanks.  I'll close this bug.

[-- Attachment #2: Type: text/html, Size: 1089 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#58850: 29.0.50; sqlite crashes on error
  2022-11-02  3:33               ` Andrew Hyatt
@ 2022-11-02  5:00                 ` Gerd Möllmann
  0 siblings, 0 replies; 10+ messages in thread
From: Gerd Möllmann @ 2022-11-02  5:00 UTC (permalink / raw)
  To: Andrew Hyatt; +Cc: 58850, Eli Zaretskii

On 02.11.22 04:33, Andrew Hyatt wrote:
> It does work for me, thank you for the fix!  I don't think I really 
> understand what is going on here either (does anyone? is the length of 
> the path in the name the relevant thing here?), but if there's a 
> solution that works, then that's enough for me, thanks.  I'll close this 
> bug.

It was a classical stack-buffer overflow.  The "name=..." part of the
printed representation of SQLite objects was printed to a fixed-size
buffer on the processor stack.  With a long enough name, this overwrites
other stuff on the stack, like the return address, and boom.  I fixed
this by not using a buffer al all, which is the way this is done
normally.  There was actually no need for using the buffer in the first
place.

Thanks for the report, and the testing!







^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-11-02  5:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-29  0:47 bug#58850: 29.0.50; sqlite crashes on error Andrew Hyatt
2022-10-29  7:40 ` Eli Zaretskii
2022-10-29 23:44   ` Andrew Hyatt
2022-10-30  6:35     ` Eli Zaretskii
2022-11-01  4:28       ` Andrew Hyatt
2022-11-01  7:45         ` Eli Zaretskii
2022-11-01  9:03           ` Gerd Möllmann
2022-11-01  9:16             ` Gerd Möllmann
2022-11-02  3:33               ` Andrew Hyatt
2022-11-02  5:00                 ` Gerd Möllmann

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.