tree-sitter-grammars / tree-sitter-toml

TOML grammar for tree-sitter
MIT License
0 stars 1 forks source link

when used with emacs, immediate segfault when invoking comment-dwim in empty file #3

Open glyph opened 2 weeks ago

glyph commented 2 weeks ago

Did you check existing issues?

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

tree-sitter 0.22.6

Describe the bug

Fatal error 11: Segmentation fault
zsh: abort      emacs -nw a.toml

Steps To Reproduce/Bad Parse Tree

  1. compile toml to use with tree-sitter
(require 'treesit)
    (let ((treesit-language-source-alist
           `((toml . ("https://github.com/tree-sitter-grammars/tree-sitter-toml"
                      nil nil nil nil)))))
      (treesit-install-language-grammar 'toml))
  1. emacs -nw a.toml
  2. hit meta-; to insert a comment

see the segfautl

Expected Behavior/Parse Tree

I expect it to not segfault

Repro

See above

ObserverOfTime commented 2 weeks ago

Does that not happen with other parsers?

glyph commented 2 weeks ago

Does that not happen with other parsers?

Only tried python-ts-mode, but no, not with that one.

ObserverOfTime commented 2 weeks ago

Can you get a stack trace or core dump?

glyph commented 2 weeks ago

There's an ips file that macOS captured, which appears to contain a stack trace, but the only tree-sitter thing I see on the stack seems to be Ftreesit_node_type . If this is helpful, though, here it is:

Emacs-2024-06-19-004357.ips.json

ObserverOfTime commented 2 weeks ago

What I can tell from this is that it's trying to access a NULL pointer somewhere.

ObserverOfTime commented 2 weeks ago

I can't reproduce the crash on Arch Linux. It might be a macOS or ARM-specific issue. I suggest trying a few more parsers and submitting a bug report to emacs if any of them also crash.

glyph commented 2 weeks ago

I've now tried python, javascript, java, and rust, and none have issues

glyph commented 2 weeks ago

(Or, none have this specific issue).

Is there any diagnostic I can perform locally that will produce a more useful artifact for you?

ObserverOfTime commented 2 weeks ago

Maybe @amaanq can help with that.