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#60237: 30.0.50; tree sitter core dumps when I edebug view a node Date: Sat, 24 Dec 2022 09:23:32 +0200 Message-ID: <83tu1l5kp7.fsf@gnu.org> References: <87o7rx7xml.fsf@masteringemacs.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11023"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60237@debbugs.gnu.org To: Mickey Petersen , Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 24 08:24:17 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 1p8ytF-0002hO-0V for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Dec 2022 08:24:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p8yt5-0004FL-Oq; Sat, 24 Dec 2022 02:24:07 -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 1p8yt0-0004F5-Ee for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 02:24:02 -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 1p8yt0-0001j6-0L for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 02:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p8ysz-0002YW-Sb for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 02:24: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: Sat, 24 Dec 2022 07:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60237 X-GNU-PR-Package: emacs Original-Received: via spool by 60237-submit@debbugs.gnu.org id=B60237.16718666269811 (code B ref 60237); Sat, 24 Dec 2022 07:24:01 +0000 Original-Received: (at 60237) by debbugs.gnu.org; 24 Dec 2022 07:23:46 +0000 Original-Received: from localhost ([127.0.0.1]:41377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8ysj-0002YB-MV for submit@debbugs.gnu.org; Sat, 24 Dec 2022 02:23:46 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38140) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8ysg-0002Y5-DJ for 60237@debbugs.gnu.org; Sat, 24 Dec 2022 02:23:45 -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 1p8ysa-0001er-BX; Sat, 24 Dec 2022 02:23:36 -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=Kuq7xgfB9LZp4AqGyLP+kEiwFb0H4JB2uyigaqozIrE=; b=CZg9BPaVQJQN Ih1JUFXA5FK/RhlhqgmLG6tYgYgkhgqjzj7EHBEfahER8z5fP+Wh+P4TpGJuShx/JC49tFvQSr3s/ JEJFW6L9iMD240HG/8fiuR9gGik4gkxBwfmKChmOiKy+DgsK1PHyAZ9Qdx3UcAAIual+N9Q8Kb8nz jMDz3kRU0EeiHwU5X/a1LgjLB1veTKEXavFftIv0xjPfT3PTbe6AUpVmF7/EEcnRA/xz/vM1G64gw 7yW2c1FhOTWhsR2Y//d0kpcBltwa8MJkSsbpiYYdPDw48BENbpR6FOu60WPa01/haM7v3idIV8coy 2z2n/6YhsLBkSISS12QXXw==; 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 1p8ysZ-0005Xn-EM; Sat, 24 Dec 2022 02:23:36 -0500 In-Reply-To: <87o7rx7xml.fsf@masteringemacs.org> (message from Mickey Petersen on Wed, 21 Dec 2022 12:24:34 +0000) 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:251766 Archived-At: > From: Mickey Petersen > Date: Wed, 21 Dec 2022 12:24:34 +0000 Yuan, can you look into this? The crash is in tree-sitter, so maybe it isn't our bug, but I'd like to be sure. And even if it is a tree-sitter bug, maybe we can work around it to prevent Emacs from crashing? > Happens in emacs -Q (after loading some simple elisp code that uses treesit.el) and consistently and repeatedly. > > > Here's the elisp. When I edebug it I can step and view all the variables and expressions I like. The `combobulate-' functions are widely used in the library and pose no issues anywhere else and do nothing more than fetch nodes via tree sitter. It is only this bit of code that blows up, and then only when invoked inside a python string. > > > > (when-let ((navigable-node (combobulate--get-nearest-navigable-node)) ;; <-- edebugging these work fine; > (nearest-node (combobulate-node-at-point)) > (targets (seq-filter > (lambda (elem) (and elem (< elem (point)))) > (list (save-excursion (ignore-errors (backward-up-list 1 t t) (point))) > (combobulate-node-point (combobulate--nav-get-parent navigable-node)) ;; <- call into this inner form blows up when I read the argument value of `navigable-node' on the inside. > (combobulate-node-point (combobulate--nav-get-parent nearest-node)))))) > (when-let (target (apply #'max targets)) > (goto-char target) > (combobulate--flash-node (combobulate--get-nearest-navigable-node)))) > > Here is the "fix" > > (when-let* ((navigable-node (combobulate--get-nearest-navigable-node)) > (nearest-node (combobulate-node-at-point)) > (navigable-node-parent (combobulate--nav-get-parent navigable-node)) ;; <- refactor out > (nearest-node-parent (combobulate--nav-get-parent nearest-node)) ;; <- refactor out > (targets (seq-filter > (lambda (elem) (and elem (< elem (point)))) > (list (save-excursion (ignore-errors (backward-up-list 1 t t) (point))) ; <- smoking gun > (combobulate-node-point navigable-node-parent) > (combobulate-node-point nearest-node-parent))))) > (when-let (target (apply #'max targets)) > (goto-char target) > (combobulate--flash-node (combobulate--get-nearest-navigable-node)))) > > Clearly, `ignore-errors' + `backward-up-list' which throws errors left and right if it doesn't like what it's seeing is causing this. > > If I instead of edebugging just run the code, it hangs Emacs. I have to kill -9 it. > > > Core dump's half a gig; not going to attach it. > > > --- Backtrace from the dump here --- > > #0 raise (sig=) at ../sysdeps/unix/sysv/linux/raise.c:50 > #1 0x000055e6f87a8e21 in terminate_due_to_signal (sig=sig@entry=11, backtrace_limit=-117776184, backtrace_limit@entry=40) at emacs.c:464 > #2 0x000055e6f87a933d in handle_fatal_signal (sig=sig@entry=11) at sysdep.c:1783 > #3 0x000055e6f8901f2d in deliver_thread_signal (sig=sig@entry=11, handler=0x55e6f87a932c ) at sysdep.c:1775 > #4 0x000055e6f8901fad in deliver_fatal_thread_signal (sig=11) at sysdep.c:1888 > #5 handle_sigsegv (sig=11, siginfo=, arg=) at sysdep.c:1888 > #6 0x00007fb676b683c0 in () at /lib/x86_64-linux-gnu/libpthread.so.0 > #7 0x00007fb674ea6574 in ts_language_symbol_count () at /usr/local/lib/libtree-sitter.so.0 > #8 0x00007fb674ea6773 in ts_language_symbol_name () at /usr/local/lib/libtree-sitter.so.0 > #9 0x000055e6f8a01ca5 in Ftreesit_node_type (node=node@entry=XIL(0x55e6fdb98f2d)) at treesit.c:1705 > #10 0x000055e6f899ee4d in print_vectorlike > (obj=XIL(0x55e6fdb98f2d), printcharfun=XIL(0), escapeflag=, buf=0x7ffe8098a210 "\335M\351\371\346U") at print.c:2040 > #11 0x000055e6f899cb51 in print_object (obj=XIL(0x55e6fdb98f2d), printcharfun=XIL(0), escapeflag=true) at print.c:2612 > #12 0x000055e6f899d42c in Fprin1 (object=XIL(0x55e6fdb98f2d), printcharfun=XIL(0x55e6fd9fcdd5), overrides=) at print.c:777 > #13 0x000055e6f89bc627 in exec_byte_code (fun=, args_template=, nargs=, args=) > at lisp.h:2204 > #14 0x000055e6f89735f7 in Ffuncall (nargs=3, args=0x7ffe8098a530) at eval.c:2995 > #15 0x000055e6f8973880 in Fapply (nargs=2, args=0x7fb66f8327a8) at eval.c:2666 > #16 0x000055e6f89bc627 in exec_byte_code (fun=, args_template=, nargs=, args=) > at lisp.h:2204 > #17 0x000055e6f89735f7 in Ffuncall (nargs=4, args=0x7ffe8098a680) at eval.c:2995 > #18 0x000055e6f8973880 in Fapply (nargs=3, args=0x7fb66f832700) at eval.c:2666 > #19 0x000055e6f89bc627 in exec_byte_code (fun=, args_template=, nargs=, args=) > at lisp.h:2204 > #20 0x000055e6f89735f7 in Ffuncall (nargs=3, args=0x7fb66f832660) at eval.c:2995 > #21 0x000055e6f8973b0a in Fapply (nargs=3, args=0x7fb66f832660) at eval.c:2623 > #22 0x000055e6f89bc627 in exec_byte_code (fun=, args_template=, nargs=, args=) > at lisp.h:2204 > #23 0x000055e6f89bc366 in exec_byte_code (fun=, args_template=, nargs=, args=) > at bytecode.c:811 > #24 0x000055e6f89735f7 in Ffuncall (nargs=nargs@entry=3, args=args@entry=0x7ffe8098a9f8) at eval.c:2995 > #25 0x000055e6f896f293 in Ffuncall_interactively (nargs=3, args=0x7ffe8098a9f8) at callint.c:248 > #26 0x000055e6f89735f7 in Ffuncall (nargs=4, args=0x7ffe8098a9f0) at eval.c:2995 > #27 0x000055e6f8973880 in Fapply (nargs=nargs@entry=3, args=args@entry=0x7ffe8098ab60) at eval.c:2666 > #28 0x000055e6f8970c57 in Fcall_interactively (function=XIL(0x3a90730), record_flag=XIL(0), keys=XIL(0x55e6fd9f8a6d)) at lisp.h:1171 > #29 0x00007fb6706bdc95 in F636f6d6d616e642d65786563757465_command_execute_0 () > at /home/mickey/Downloads/emacs/src/../native-lisp/30.0.50-7cb43add/preloaded/simple-fab5b0cf-b9ebea66.eln > #30 0x000055e6f89735f7 in Ffuncall (nargs=nargs@entry=2, args=args@entry=0x7ffe8098ad10) at eval.c:2995 > #31 0x000055e6f88f5ea0 in call1 (arg1=, fn=XIL(0x4c20)) at lisp.h:3247 > #32 command_loop_1 () at keyboard.c:1495 > #33 0x000055e6f8971bf7 in internal_condition_case > (bfun=bfun@entry=0x55e6f88f5a80 , handlers=handlers@entry=XIL(0x90), hfun=hfun@entry=0x55e6f88e8b60 ) > at eval.c:1474 > #34 0x000055e6f88e11ea in command_loop_2 (handlers=handlers@entry=XIL(0x90)) at keyboard.c:1125 > #35 0x000055e6f8971b39 in internal_catch > (tag=tag@entry=XIL(0x6b10), func=func@entry=0x55e6f88e11c0 , arg=arg@entry=XIL(0x90)) at eval.c:1197 > #36 0x000055e6f88e113c in command_loop () at lisp.h:1171 > #37 0x000055e6f88e86b8 in recursive_edit_1 () at keyboard.c:712 > #38 0x000055e6f88e8a60 in Frecursive_edit () at keyboard.c:795 > #39 0x000055e6f89bc627 in exec_byte_code (fun=, args_template=, nargs=, args=) > at lisp.h:2204 > #40 0x000055e6f89735f7 in Ffuncall (nargs=3, args=0x7fb66f8323d8) at eval.c:2995 > #41 0x000055e6f8973b0a in Fapply (nargs=3, args=0x7fb66f8323d8) at eval.c:2623 > #42 0x000055e6f89bc627 in exec_byte_code (fun=, args_template=, nargs=, args=) > at lisp.h:2204 > #43 0x000055e6f8978c0f in apply_lambda (fun=, args=, count=...) at eval.c:3103 > #44 0x000055e6f8976d4b in eval_sub (form=) at eval.c:2588 > #45 0x000055e6f8978bce in apply_lambda (fun=, args=, count=...) at eval.c:3098 > #46 0x000055e6f8976d4b in eval_sub (form=) at eval.c:2588 > #47 0x000055e6f897862d in Fprogn (body=XIL(0)) at eval.c:436 > #48 funcall_lambda (fun=XIL(0x55e6fc3bf1f3), nargs=0, arg_vector=0x7fb66f832168) at eval.c:3233 > #49 0x000055e6f89bc366 in exec_byte_code (fun=, args_template=, nargs=, args=) > at bytecode.c:811 > #50 0x000055e6f8978c0f in apply_lambda (fun=, args=, count=...) at eval.c:3103 > #51 0x000055e6f8976d4b in eval_sub (form=) at eval.c:2588 > #52 0x000055e6f897862d in Fprogn (body=XIL(0)) at eval.c:436 > #53 funcall_lambda (fun=XIL(0x55e6f9db7153), nargs=1, arg_vector=0x7ffe8098b670) at eval.c:3233 > #54 0x000055e6f8978c0f in apply_lambda (fun=, args=, count=...) at eval.c:3103 > #55 0x000055e6f8976d4b in eval_sub (form=) at eval.c:2588 > #56 0x000055e6f8978bce in apply_lambda (fun=, args=, count=...) at eval.c:3098 > #57 0x000055e6f8976d4b in eval_sub (form=) at eval.c:2588 > #58 0x000055e6f897723d in eval_sub (form=) at eval.c:2465 > #59 0x000055e6f8978bce in apply_lambda (fun=, args=, count=...) at eval.c:3098 > #60 0x000055e6f8976d4b in eval_sub (form=) at eval.c:2588 > #61 0x000055e6f897774d in Fand (args=XIL(0)) at eval.c:370 > #62 0x000055e6f8977428 in eval_sub (form=) at lisp.h:2204 > #63 0x000055e6f8979496 in FletX (args=XIL(0x55e6fd7f83c3)) at lisp.h:1522 > #64 0x000055e6f8977428 in eval_sub (form=) at lisp.h:2204 > #65 0x000055e6f8977f97 in Fprog1 (args=XIL(0x55e6fd7f7c13)) at lisp.h:1516 > #66 0x000055e6f8977428 in eval_sub (form=) at lisp.h:2204 > #67 0x000055e6f89797eb in Funwind_protect (args=XIL(0x55e6fd7f7c73)) at lisp.h:1516 > #68 0x000055e6f8977428 in eval_sub (form=) at lisp.h:2204 > #69 0x000055e6f8979235 in Fprogn (body=XIL(0)) at eval.c:436 > #70 Flet (args=) at eval.c:1026 > #71 0x000055e6f8977428 in eval_sub (form=) at lisp.h:2204 > #72 0x000055e6f8979235 in Fprogn (body=XIL(0)) at eval.c:436 > #73 Flet (args=) at eval.c:1026 > #74 0x000055e6f8977428 in eval_sub (form=) at lisp.h:2204 > #75 0x000055e6f8977ef5 in Fprogn (body=XIL(0x55e6fd8a41b3)) at eval.c:436 > #76 prog_ignore (body=XIL(0x55e6fd7f7e03)) at eval.c:447 > #77 Fwhile (args=) at eval.c:1047 > #78 0x000055e6f8977428 in eval_sub (form=) at lisp.h:2204 > #79 0x000055e6f897964d in Fprogn (body=XIL(0)) at eval.c:436 > #80 FletX (args=XIL(0x55e6fd7f7eb3)) at eval.c:958 > #81 0x000055e6f8977428 in eval_sub (form=) at lisp.h:2204 > #82 0x000055e6f897862d in Fprogn (body=XIL(0)) at eval.c:436 > #83 funcall_lambda (fun=XIL(0x55e6fd7f7f93), nargs=1, arg_vector=0x7ffe8098c4e0) at eval.c:3233 > #84 0x000055e6f89735f7 in Ffuncall (nargs=nargs@entry=2, args=args@entry=0x7ffe8098c4d8) at eval.c:2995 > #85 0x000055e6f896f293 in Ffuncall_interactively (nargs=2, args=0x7ffe8098c4d8) at callint.c:248 > #86 0x000055e6f89735f7 in Ffuncall (nargs=nargs@entry=3, args=args@entry=0x7ffe8098c4d0) at eval.c:2995 > #87 0x000055e6f89708d3 in Fcall_interactively (function=, record_flag=, keys=) > at callint.c:785 > #88 0x00007fb6706bdc95 in F636f6d6d616e642d65786563757465_command_execute_0 () > at /home/mickey/Downloads/emacs/src/../native-lisp/30.0.50-7cb43add/preloaded/simple-fab5b0cf-b9ebea66.eln > #89 0x000055e6f89735f7 in Ffuncall (nargs=nargs@entry=2, args=args@entry=0x7ffe8098c7b0) at eval.c:2995 > #90 0x000055e6f88f5ea0 in call1 (arg1=, fn=XIL(0x4c20)) at lisp.h:3247 > #91 command_loop_1 () at keyboard.c:1495 > #92 0x000055e6f8971bf7 in internal_condition_case > (bfun=bfun@entry=0x55e6f88f5a80 , handlers=handlers@entry=XIL(0x90), hfun=hfun@entry=0x55e6f88e8b60 ) > at eval.c:1474 > #93 0x000055e6f88e11ea in command_loop_2 (handlers=handlers@entry=XIL(0x90)) at keyboard.c:1125 > #94 0x000055e6f8971b39 in internal_catch > (tag=tag@entry=XIL(0xffc0), func=func@entry=0x55e6f88e11c0 , arg=arg@entry=XIL(0x90)) at eval.c:1197 > #95 0x000055e6f88e1186 in command_loop () at lisp.h:1171 > #96 0x000055e6f88e86b8 in recursive_edit_1 () at keyboard.c:712 > #97 0x000055e6f88e8a60 in Frecursive_edit () at keyboard.c:795 > #98 0x000055e6f87b23b8 in main (argc=, argv=) at emacs.c:2529 > > --- END --- > > > > In GNU Emacs 30.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version > 3.24.20, cairo version 1.16.0) of 2022-11-29 built on mickey-work > Repository revision: 7939184f8e0370e7a3397d492812c6d202c2a193 > Repository branch: master > Windowing system distributor 'The X.Org Foundation', version 11.0.12013000 > System Description: Ubuntu 20.04.3 LTS > > Configured using: > 'configure --with-native-compilation --with-json --with-mailutils > --without-compress-install --with-imagemagick CC=gcc-10' > > Configured features: > ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ > IMAGEMAGICK JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 > M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP > SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE > XIM XINPUT2 XPM GTK3 ZLIB > > Important settings: > value of $LC_MONETARY: en_GB.UTF-8 > value of $LC_NUMERIC: en_GB.UTF-8 > value of $LC_TIME: en_GB.UTF-8 > value of $LANG: en_GB.UTF-8 > value of $XMODIFIERS: @im=ibus > locale-coding-system: utf-8-unix > > > > > >