Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault in neovim when injected in markdown #124

Open
kyazdani42 opened this issue Jul 2, 2022 · 14 comments
Open

Segfault in neovim when injected in markdown #124

kyazdani42 opened this issue Jul 2, 2022 · 14 comments

Comments

@kyazdani42
Copy link

kyazdani42 commented Jul 2, 2022

Hi,
when injecting an elm tag inside markdown in neovim, neovim will segfault.
To reproduce:

  • open nvim test.md (with nvim-treesitter and elm/markdown parsers installed)
  • write:
```elm
`

I first thought it was related to the markdown parser, but since other languages do not segfault, i believe this is related to this parser.

kyazdani42 added a commit to kyazdani42/nvim-treesitter that referenced this issue Jul 15, 2022
the Elm parser segfaults when injected in markdown. Disable it for now.
See elm-tooling/tree-sitter-elm#124
theHamsta pushed a commit to nvim-treesitter/nvim-treesitter that referenced this issue Jul 15, 2022
the Elm parser segfaults when injected in markdown. Disable it for now.
See elm-tooling/tree-sitter-elm#124
@bhansconnect
Copy link

bhansconnect commented Dec 8, 2022

This unsurprisingly is also reproducible in other editors. I just hit it in helix. Someone else also hit it an filed a while back: helix-editor/helix#3745

@kyazdani42
Copy link
Author

Update: this bug doesn't seem to happen anymore. However, it seems writing any elm code in a fenced markdown code block leads to the editor crashing.

@thistent
Copy link

thistent commented May 6, 2023

I just encountered a similar problem in helix with a normal Elm module (with an invalid use of an undefined type instance as the input to a case expression): helix-editor/helix#6981

@bburdette
Copy link

reproduced this in helix with dillonkearns/elm-markdown. cd to repo, space-f, segfault. helix 23.03, elm-language-server 2.7.0.

@razzeee
Copy link
Member

razzeee commented May 10, 2023

I'm not able to reproduce it, entering the mentioned code in test.elm and running npm run parse-test. I've tried with all inbetween states I could think of.

@bburdette
Copy link

maybe the problem isn't in the parsing but something that happens after that? just guessing

@moniquelive
Copy link

If it helps, here's a fresh stack trace taken today:

(gdb) bt
#0  0x0000555555951d24 in ts_decode_utf8 ()
#1  0x0000555555951f27 in ts_lexer.get_lookahead ()
#2  0x00005555559522b2 in ts_lexer.get_column ()
#3  0x00007ffff57302bb in tree_sitter_elm_external_scanner_scan () from /home/cyber/.local/share/nvim/lazy/nvim-treesitter/parser/elm.so
#4  0x000055555593f03a in ts_parser_parse ()
#5  0x000055555574f67e in parser_parse.lto_priv ()
#6  0x00005555559773f6 in lj_BC_FUNCC ()
#7  0x00005555559637f6 in lua_pcall (L=0x7ffff7e65380, nargs=<optimized out>, nresults=1, errfunc=<optimized out>) at lj_api.c:1116
#8  0x000055555573ed08 in nlua_pcall ()
#9  0x0000555555744640 in nlua_call_ref ()
#10 0x0000555555631937 in getnextac ()
#11 0x00005555556daecc in do_cmdline ()
#12 0x0000555555630b38 in apply_autocmds_group ()
#13 0x00005555557c8cc0 in did_set_string_option ()
#14 0x00005555557cb61f in set_string_option ()
#15 0x00005555556e3e73 in ex_setfiletype.lto_priv ()
#16 0x00005555556d7d8d in execute_cmd0 ()
#17 0x00005555556d83e4 in execute_cmd ()
#18 0x0000555555604e0b in nvim_cmd ()
#19 0x00005555555e8fba in nlua_api_nvim_cmd.lto_priv ()
#20 0x00005555559773f6 in lj_BC_FUNCC ()
#21 0x00005555559637f6 in lua_pcall (L=0x7ffff7e65380, nargs=<optimized out>, nresults=1, errfunc=<optimized out>) at lj_api.c:1116
#22 0x000055555573ed08 in nlua_pcall ()
#23 0x0000555555744640 in nlua_call_ref ()
#24 0x00005555555ffe7f in nvim_buf_call ()
#25 0x00005555555e886b in nlua_api_nvim_buf_call.lto_priv ()
#26 0x00005555559773f6 in lj_BC_FUNCC ()
#27 0x00005555559637f6 in lua_pcall (L=0x7ffff7e65380, nargs=<optimized out>, nresults=1, errfunc=<optimized out>) at lj_api.c:1116
#28 0x000055555573ed08 in nlua_pcall ()
#29 0x0000555555744640 in nlua_call_ref ()
#30 0x0000555555631937 in getnextac ()
#31 0x00005555556daecc in do_cmdline ()
#32 0x0000555555630b38 in apply_autocmds_group ()
#33 0x00005555556faad6 in readfile ()
#34 0x00005555556383fb in open_buffer ()
#35 0x00005555555e26fd in main ()

@maca
Copy link

maca commented Sep 20, 2023

had the same issue in helix with dillonkearns/elm-markdown

helix-editor/helix#6981

@aaaaargZombies
Copy link

Just discovered the same issue in neovim with codeblocks and elm in markdown, I was going to post an issue but instead I guess I'll just follow this thread.

In the mean time I'm currently trying to figure out if I can disable specific parsers on a per file type basis, will report back if if this works as a temporary fix.

@aaaaargZombies
Copy link

For anyone else who is having the same issue, I updated nvim to v0.9.5 and the issue is no longer effecting me.

@kyazdani42
Copy link
Author

I don't see this issue too anymore, should we close it ?

@bburdette
Copy link

I'm still seeing this crash in elm-language-server 2.8.0, with the helix editor.

@aaaaargZombies
Copy link

I'm still seeing this crash in elm-language-server 2.8.0, with the helix editor.

looks like helix is behind this repo https://github.com/helix-editor/helix/blob/master/languages.toml#L1674 might be an easy PR to make if that fixes it?

@bburdette
Copy link

I put this

[[grammar]]
name = "elm"
source = { git = "https://github.com/elm-tooling/tree-sitter-elm" , rev = "09dbf221d7491dc8d8839616b27c21b9c025c457" }

Into my .config/helix/langauges.toml file, but it still crashes. rev is current main since feb 18.

No idea if I'm doing it right, but gave it a shot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants