Closed josteink closed 3 years ago
This is already fixed on tree-sitter runtime 0.19.3. The bug is present in tree-sitter runtime version 0.19.[0-2].Therw is probably one problematic query that triggers the crash. So you can bisect if you don't want to do a manual build of the newer tree-sitter version.
The problem: https://github.com/tree-sitter/tree-sitter/issues/968#issuecomment-792314281 The fix: https://github.com/tree-sitter/tree-sitter/pull/971
Oh I see. That's certainly helpful.
That said, if this is already fixes in 0.19.3
, how come I still get the error when trying to rebuild tsc-dyn.so
in place using cargo build
?
0.19.3 already seems to re referenced by Cargo.toml:
[package]
name = "emacs-tree-sitter"
version = "0.15.0"
authors = ["Tuấn-Anh Nguyễn <ubolonton@gmail.com>"]
edition = "2018"
publish = false
[lib]
path = "src/lib.rs"
name = "tsc_dyn"
crate-type = ["cdylib"]
[dependencies]
emacs = "0.17"
libloading = "0.7.0"
tree-sitter = "0.19.3"
once_cell = "1.7.2"
I guess if I can't find a way to bypass this bug, I will be forced to bisect the grammar, yes.
It also seems like 0.19.3
is the latest tree-sitter rust-crate too.
Could I be having some stale caches somewhere?
I encountered this issue originally in csharp-mode
which provides its own grammar through ELISP. If I understand it correctly, it should not be possible for elisp-based grammer to have unbalanced parenthesis... So in that case this error probably had a different root cause?
For reference, I did a bisect and managed to isolate the offending rules as seen in this commit: https://github.com/emacs-csharp/csharp-mode/commit/65669643834b8bda7d950185688754cc10bc15a5
Any ideas on why those would make tree-sitter crash? Should this be reported further upstream?
This is already fixed on tree-sitter runtime 0.19.3. The bug is present in tree-sitter runtime version 0.19.[0-2].Therw is probably one problematic query that triggers the crash. So you can bisect if you don't want to do a manual build of the newer tree-sitter version.
The problem: tree-sitter/tree-sitter#968 (comment) The fix: tree-sitter/tree-sitter#971
That is a related but probably different issue.
This issue is caused by this assertion. Tree-sitter 0.19.4 still has it:
echo '(prefix_unary_expression (identifier)* @variable)' | tree-sitter query /dev/stdin /tmp/empty.cs
Assertion failed: (exists), function ts_query__analyze_patterns, file src/./query.c, line 1236.
[1] 3970 done echo '(prefix_unary_expression (identifier)* @variable)' |
3971 abort tree-sitter query /dev/stdin /tmp/empty.cs
Ooh great. Will give it a try 😃
Confirmed no longer crashing my emacs, even with (somehow) invalid queries. Great job!
Thanks for the quick fix. Even quicker than the tree-sitter crate getting published :astonished:
Using latest Emacs built from git-master (
a9a4af6ff18487938f4859418e8e27ffb174af7c
) and latesttree-sitter
package(s) from MELPA, activating tree-sitter (forcsharp-tree-sitter-mode
) causes Emacs to SIGABRT.Please note: I was forced to wipe my
~/.emacs.d/elpa
folder after dist-upgrading, and then re-building Emacs from latest sources, and thus most likely pulled in the latest version oftree-sitter
too at the same time. This could in theory be a general regression.The following is the backtrace when Emacs is invoked through
gdb
:Checking
tsc-dyn.so
usingldd
gives the following output, which looks OK to me:I'm honestly not sure if this bug is related to Ubuntu 20.10, or something else.