ganezdragon / tree-sitter-perl

a perl parser for javascript
MIT License
33 stars 9 forks source link

the parser segfaults tree-sitter when opening a fairly large perl file (in neovim) #18

Closed nekopsykose closed 1 year ago

nekopsykose commented 2 years ago

opening inxi from https://github.com/smxi/inxi/commit/a5e8e3eec7796ea38679c8c3c8c5da0e53cd2d87 seems to cause a segfault in tree-sitter. not having the tree-sitter-perl parser installed via nvim-treesitter fixes that.

backtrace ``` Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007fb939a6dd0e in ts_subtree_is_keyword (self=...) at lib/src/./subtree.h:219 219 static inline bool ts_subtree_is_keyword(Subtree self) { return SUBTREE_GET(self, is_keyword); } [Current thread is 1 (LWP 77142)] (gdb) bt full #0 0x00007fb939a6dd0e in ts_subtree_is_keyword (self=...) at lib/src/./subtree.h:219 No locals. #1 ts_parser__advance (self=0x7fb939937cd0, version=3, allow_node_reuse=) at lib/src/parser.c:1546 last_reduction_version = lookahead = {data = {is_inline = false, visible = false, named = false, extra = false, has_changes = false, is_missing = false, is_keyword = false, symbol = 0 '\000', parse_state = 0, padding_columns = 0 '\000', padding_rows = 0 '\000', lookahead_bytes = 0 '\000', padding_bytes = 0 '\000', size_bytes = 0 '\000'}, ptr = 0x0} table_entry = {actions = , action_count = 1, is_reusable = } last_external_token = {data = {is_inline = false, visible = false, named = false, extra = false, has_changes = false, is_missing = true, is_keyword = false, symbol = 32 ' ', parse_state = 12968, padding_columns = 185 '\271', padding_rows = 15 '\017', lookahead_bytes = 7 '\a', padding_bytes = 0 '\000', size_bytes = 0 '\000'}, ptr = 0x7fb932a820a0} state = position = did_reuse = needs_lex = false last_reduction_version = i = action = next_state = reduction_version = is_fragile = end_of_non_terminal_extra = mutable_lookahead = #2 ts_parser_parse (self=0x7fb939937cd0, old_tree=, input=...) at lib/src/parser.c:1904 allow_node_reuse = version = 3 min_error_cost = position = last_position = 1129015 version_count = result = #3 0x0000558b413bfbc3 in parser_parse (L=0x7fb93998d380) at /home/demon/src/neovim/src/nvim/lua/treesitter.c:380 input = {payload = 0x7fb9399bd060, read = 0x558b413c00f0 , encoding = TSInputEncodingUTF8} p = 0x7fb938845ef0 old_tree = 0x0 new_tree = 0x0 len = str = n_ranges = bufnr = buf = 0x5 changed = #4 0x00007fb9399f8f75 in ?? () from /usr/lib/libluajit-5.1.so.2 No symbol table info available. #5 0x00007fb939a39332 in lua_pcall () from /usr/lib/libluajit-5.1.so.2 No symbol table info available. #6 0x0000558b413b9201 in nlua_pcall (lstate=0x7fb93998d380, nresults=1, nargs=) at /home/demon/src/neovim/src/nvim/lua/executor.c:130 status = #7 nlua_call_ref (ref=, name=, args=..., retval=true, err=0x0) at /home/demon/src/neovim/src/nvim/lua/executor.c:1369 lstate = 0x7fb93998d380 nargs = 1 #8 0x0000558b4125ce7b in call_autocmd_callback (ac=0x7fb939942810, apc=0x7ffd8bc5b310) at /home/demon/src/neovim/src/nvim/autocmd.c:2057 data = {size = 6, capacity = 8, items = 0x7fb938ea4650} group = args = {size = 1, capacity = 0, items = 0x7ffd8bc5a9e0} args__items = {{type = kObjectTypeDictionary, data = {boolean = 6, integer = 6, floating = 2.9643938750474793e-323, string = {data = 0x6 , size = 8}, array = {size = 6, capacity = 8, items = 0x7fb938ea4650}, dictionary = { size = 6, capacity = 8, items = 0x7fb938ea4650}, luaref = 6}}} result = {type = kObjectTypeNil, data = {boolean = false, integer = 0, floating = 0, string = {data = 0x0, size = 0}, array = {size = 0, capacity = 0, items = 0x0}, dictionary = {size = 0, capacity = 0, items = 0x0}, luaref = 0}} callback = {data = {funcref = 0x1a , partial = 0x1a, luaref = 26}, type = kCallbackLua} ret = false #9 getnextac (c=, cookie=0x7ffd8bc5b310, indent=, do_concat=) at /home/demon/src/neovim/src/nvim/autocmd.c:2138 acp = 0x7ffd8bc5b310 ac = 0x7fb939942810 oneshot = false retval = #10 0x0000558b413344c0 in do_cmdline (cmdline=, fgetline=0x558b4125c7a0 , cookie=0x7ffd8bc5b310, flags=7) at /home/demon/src/neovim/src/nvim/ex_docmd.c:522 recursive = 2 call_depth = 3 cstack = {cs_flags = {0 }, cs_pending = '\000' , cs_pend = {csp_rv = {0x0 }, csp_ex = {0x0 }}, cs_forinfo = {0x0 }, cs_line = {0 }, cs_idx = -1, cs_looplevel = 0, cs_trylevel = 0, cs_emsg_silent_list = 0x0, cs_lflags = 0} lines_ga = {ga_len = 0, ga_maxlen = 0, ga_itemsize = 16, ga_growsize = 10, ga_data = 0x0} cmd_loop_cookie = {lines_gap = 0xffffffd0, current_line = -1949979304, repeating = 32765, getline = 0x0, cookie = 0xfffffc4300000000} cmdline_copy = used_getline = true msg_didout_before_start = false count = 6 did_inc = 0 retval = 1 saved_msg_list = 0x0 current_line = 0 fname = 0x0 breakpoint = 0x0 dbg_tick = 0x0 private_msg_list = 0x0 debug_saved = {trylevel = 0, force_abort = 0, caught_stack = 0x0, vv_exception = 0x0, vv_throwpoint = 0x0, did_emsg = 0, got_int = 0, need_rethrow = 0, check_cstack = 0, current_exception = 0x0} initial_trylevel = 0 next_cmdline = 0x0 cmd_getline = 0x558b4125c7a0 cmd_cookie = 0x7ffd8bc5b310 real_cookie = getline_is_func = #11 0x0000558b4125adfd in apply_autocmds_group (event=EVENT_FILETYPE, fname=0x7fb939ab8bb0 "perl", fname_io=, force=, group=-3, buf=0x7fb9399bd060, eap=0x0, data=0x0) at /home/demon/src/neovim/src/nvim/autocmd.c:1844 nesting = 2 filechangeshell_busy = 0 save_redo = {sr_redobuff = {bh_first = {b_next = 0x0, b_str = ""}, bh_curr = 0x0, bh_index = 0, bh_space = 94056585401280}, sr_old_redobuff = {bh_first = {b_next = 0x7fb939b48c78 , b_str = }, bh_curr = 0x7fb939b48e0f <__libc_free+387>, bh_index = 13958643711, bh_space = 94056585495512}} save_current_sctx = {sc_sid = 63, sc_seq = 81, sc_lnum = 0} funccal_entry = {top_funccal = 0x0, next = 0x7ffd8bc5bfc8} patcmd = {curpat = 0x7fb938be59b0, nextcmd = 0x7fb939942810, group = -3, fname = 0x7fb939ab8bb0 "perl", sfname = 0x7fb9388a3490 "perl", tail = 0x7fb939ab8bb0 "perl", event = EVENT_FILETYPE, arg_bufnr = 1, data = 0x0, next = 0x7ffd8bc5db80} save_KeyTyped = false sfname = 0x7fb9388a3490 "perl" retval = true did_save_redobuff = save_autocmd_fname = 0x7fb9386ad520 "/usr/bin/inxi" save_autocmd_bufnr = 1 save_autocmd_match = 0x7fb9388c8040 "/usr/bin/inxi" save_autocmd_busy = 1 old_curbuf = 0x7fb9399bd060 save_sourcing_name = 0x7fb9386afa20 "/usr/local/share/nvim/runtime/scripts.vim" save_sourcing_lnum = 115 wait_time = tail = save_cmdbang = 0 save_cmdarg = 0x0 ap = save_autocmd_nested = save_changed = #12 0x0000558b41454cc3 in apply_autocmds (event=EVENT_FILETYPE, fname=0xffffffff , fname_io=0x0, force=, buf=0x7fb9388b4380) at /home/demon/src/neovim/src/nvim/autocmd.c:1513 No locals. #13 did_set_string_option (opt_idx=, varp=, new_value_alloced=true, oldval=0x558b41166cb6 "", errbuf=, errbuflen=, opt_flags=0, value_checked=0x7ffd8bc5b64c) at /home/demon/src/neovim/src/nvim/option.c:3349 secure_save = 0 syn_recursive = 0 ft_recursive = 1 free_oldval = value_changed = errmsg = did_chartab = gvarp = p = s = ambw_end = #14 0x0000558b4144f59a in do_set (arg=, opt_flags=948650880) at /home/demon/src/neovim/src/nvim/option.c:1662 p = secure_saved = 0 save_arg = origval_g = saved_origval = 0x7fb9383de300 "" saved_origval_g = 0x7fb9383de360 "" saved_newval = 0x7fb939a9f770 "perl" new_value_alloced = true newval = comma = oldval = 0x0 origval = 0x558b41166cb6 "" s = origval_l = saved_origval_l = 0x7fb9383de320 "" newlen = value_checked = 1 value_is_replaced = errbuf = "\300\216\301\070\377\377\377\177\001\000\000\000\000\000\000\000P\224]A\213U\000\000Ύ\301\070\271\177\000\000P\202>A\213U\000\000/X\267\071\271\177\000\000 \270ŋ\375\177\000\000L\200\027A\213U\000\000l\000\000\000\000\000\000\000A\256\063A\213U\000" varp = 0xffffffff did_show = 0 errmsg = 0x0 startarg = 0x7fb938c18ec8 "ft=perl" prefix = key = opt_idx = len = afterchar = adding = prepending = removing = flags = value = i = nextchar = #15 0x0000558b41336a7f in do_one_cmd (cmdlinep=0x7ffd8bc5b818, flags=7, cstack=0x7ffd8bc5b8f8, fgetline=0x558b413317a0 , cookie=0x7ffd8bc5bfe8) at /home/demon/src/neovim/src/nvim/ex_docmd.c:2320 ea = {arg = 0x7fb938c18ec8 "ft=perl", args = 0x0, arglens = 0x0, argc = 0, nextcmd = 0x0, cmd = 0x7fb938c18ec4 "set ft=perl", cmdlinep = 0x7ffd8bc5b818, cmdidx = CMD_set, argt = 786694, skip = 0, forceit = 0, addr_count = 0, line1 = 1, line2 = 1, addr_type = ADDR_NONE, flags = 0, do_ecmd_cmd = 0x0, do_ecmd_lnum = 0, append = 0, usefilter = 0, amount = 0, regname = 0, force_bin = 0, read_edit = 0, force_ff = 0, force_enc = 0, bad_char = 0, useridx = 0, errmsg = 0x0, getline = 0x558b413317a0 , cookie = 0x7ffd8bc5bfe8, cstack = 0x7ffd8bc5b8f8} save_cmdmod = {cmod_flags = 0, cmod_split = 0, cmod_tab = 0, cmod_filter_pat = 0x0, cmod_filter_regmatch = {regprog = 0x0, startp = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, endp = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, rm_ic = false}, cmod_filter_force = false, cmod_verbose = 0, cmod_save_ei = 0x0, cmod_did_sandbox = 0, cmod_verbose_save = 0, cmod_save_msg_silent = 0, cmod_save_msg_scroll = 0, cmod_did_esilent = 0} errormsg = 0x0 save_reg_executing = 0 save_pending_end_reg_executing = false after_modifier = cmd = p = ni = lnum = skip = ret = cmdname = #16 do_cmdline (cmdline=, fgetline=0x558b413317a0 , cookie=0x7ffd8bc5bfe8, flags=7) at /home/demon/src/neovim/src/nvim/ex_docmd.c:595 recursive = 2 call_depth = 3 cstack = {cs_flags = {3, 3, 5, 0 }, cs_pending = '\000' , cs_pend = {csp_rv = {0x0 }, csp_ex = {0x0 }}, cs_forinfo = {0x0 }, cs_line = {0 }, cs_idx = 1, cs_looplevel = 0, cs_trylevel = 0, cs_emsg_silent_list = 0x0, cs_lflags = 0} lines_ga = {ga_len = 0, ga_maxlen = 0, ga_itemsize = 16, ga_growsize = 10, ga_data = 0x0} cmd_loop_cookie = {lines_gap = 0x7fb9388b9453, current_line = 16777216, repeating = 117, getline = 0x46, cookie = 0x7ffd8bc5ba10} cmdline_copy = 0x7fb938c18ec0 " set ft=perl" used_getline = true msg_didout_before_start = false count = did_inc = 0 retval = 1 saved_msg_list = 0x0 current_line = 0 fname = 0x7fb9386afa20 "/usr/local/share/nvim/runtime/scripts.vim" breakpoint = 0x7ffd8bc5c000 dbg_tick = 0x7ffd8bc5c010 private_msg_list = 0x0 debug_saved = {trylevel = 0, force_abort = 0, caught_stack = 0x0, vv_exception = 0x0, vv_throwpoint = 0x0, did_emsg = 0, got_int = 0, need_rethrow = 0, check_cstack = 0, current_exception = 0x0} initial_trylevel = 0 next_cmdline = cmd_getline = 0x558b413317a0 cmd_cookie = 0x7ffd8bc5bfe8 real_cookie = getline_is_func = #17 0x0000558b4133101d in do_source (fname=0x7fb9388cc770 "/usr/local/share/nvim/runtime/scripts.vim", check_other=, is_vimrc=) at /home/demon/src/neovim/src/nvim/ex_cmds2.c:2081 cookie = {fp = 0x7fb938c56fd0, nextline = 0x7fb939944ee0 "", sourcing_lnum = 115, finished = 0, breakpoint = 0, fname = 0x7fb9386afa20 "/usr/local/share/nvim/runtime/scripts.vim", dbg_tick = 0, level = 1, conv = {vc_type = 0, vc_factor = 32765, vc_fd = 0x0, vc_fail = 6}} funccalp_entry = {top_funccal = 0x0, next = 0x7ffd8bc5dbc8} save_current_sctx = {sc_sid = 19, sc_seq = 19, sc_lnum = 2305} save_debug_break_level = -1 si = trigger_source_post = false firstline = 0x7fb938c038e0 "\" Vim support file to detect file types in scripts" retval = 0 p = fname_exp = 0x7fb9386afa20 "/usr/local/share/nvim/runtime/scripts.vim" save_sourcing_name = 0x7fb9388ccc80 "BufReadPost Autocommands for \"*\"" save_sourcing_lnum = 0 l_time_fd = 0x0 start_time = l_do_profiling = wait_start = rel_time = #18 0x0000558b414c4c8f in do_in_cached_path (name=0x7fb9388b3f6a "scripts.vim", flags=1, callback=0x558b414c69a0 , cookie=0x0) at /home/demon/src/neovim/src/nvim/runtime.c:271 pat = {0x7ffd8bc5c240 "/usr/local/share/nvim/runtime/scripts.vim"} ew_flags = 3 np = 0x7fb9388b3f75 "" item = buflen = j = 37 buf = "/usr/local/share/nvim/runtime/scripts.vim\000qs/start/vimpeccable/scripts.vim\000\000\000\000ripts.vim\000\000m", '\000' , "\240\337\060A\213U\000\000\340\067\304\070\271\177\000\000\030\303ŋ\375\177\000\000\330\310ŋ\375\177\000\000\230\310ŋ\375\177", '\000' ... did_one = ref = 1 path = {size = 49, capacity = , items = 0x7fb938c4d6b0} tail = 0x7ffd8bc5c25e "scripts.vim" files = 0x1 i = 0 num_files = #19 0x0000558b414c3802 in do_in_runtimepath (name=0x7fb9388b3f6a "scripts.vim", flags=1, cookie=0x0, callback=) at /home/demon/src/neovim/src/nvim/runtime.c:616 success = 0 #20 source_runtime (name=0x7fb9388b3f6a "scripts.vim", flags=1) at /home/demon/src/neovim/src/nvim/runtime.c:634 No locals. #21 ex_runtime (eap=) at /home/demon/src/neovim/src/nvim/runtime.c:57 arg = 0x7fb9388b3f6a "scripts.vim" p = flags = 1 len = #22 0x0000558b41336a7f in do_one_cmd (cmdlinep=0x7ffd8bc5d3d8, flags=7, cstack=0x7ffd8bc5d4b8, fgetline=0x558b4125c7a0 , cookie=0x7ffd8bc5db80) at /home/demon/src/neovim/src/nvim/ex_docmd.c:2320 ea = {arg = 0x7fb9388b3f6a "scripts.vim", args = 0x0, arglens = 0x0, argc = 0, nextcmd = 0x7fb9388b3f77 " endif", cmd = 0x7fb9388b3f61 "runtime! scripts.vim", cmdlinep = 0x7ffd8bc5d3d8, cmdidx = CMD_runtime, argt = 786830, skip = 0, forceit = 1, addr_count = 0, line1 = 1, line2 = 1, addr_type = ADDR_NONE, flags = 0, do_ecmd_cmd = 0x0, do_ecmd_lnum = 0, append = 0, usefilter = 0, amount = 0, regname = 0, force_bin = 0, read_edit = 0, force_ff = 0, force_enc = 0, bad_char = 0, useridx = 0, errmsg = 0x0, getline = 0x558b4125c7a0 , cookie = 0x7ffd8bc5db80, cstack = 0x7ffd8bc5d4b8} save_cmdmod = {cmod_flags = 0, cmod_split = 0, cmod_tab = 0, cmod_filter_pat = 0x0, cmod_filter_regmatch = {regprog = 0x0, startp = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, endp = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, rm_ic = false}, cmod_filter_force = false, cmod_verbose = 0, cmod_save_ei = 0x0, cmod_did_sandbox = 0, cmod_verbose_save = 0, cmod_save_msg_silent = 0, cmod_save_msg_scroll = 0, cmod_did_esilent = 0} errormsg = 0x0 save_reg_executing = 0 save_pending_end_reg_executing = false after_modifier = cmd = p = ni = lnum = skip = ret = cmdname = #23 do_cmdline (cmdline=, fgetline=0x558b4125c7a0 , cookie=0x7ffd8bc5db80, flags=7) at /home/demon/src/neovim/src/nvim/ex_docmd.c:595 recursive = 2 call_depth = 3 cstack = {cs_flags = {3, 0 }, cs_pending = '\000' , cs_pend = {csp_rv = {0x0 }, csp_ex = {0x0 }}, cs_forinfo = {0x0 }, cs_line = {0 }, cs_idx = 0, cs_looplevel = 0, cs_trylevel = 0, cs_emsg_silent_list = 0x0, cs_lflags = 0} lines_ga = {ga_len = 0, ga_maxlen = 0, ga_itemsize = 16, ga_growsize = 10, ga_data = 0x0} cmd_loop_cookie = {lines_gap = 0x0, current_line = 0, repeating = -957, getline = 0x7ffd8bc5d7a0, cookie = 0x7fb939010930} cmdline_copy = 0x7fb9388b3f60 " runtime! scripts.vim" used_getline = true msg_didout_before_start = false count = did_inc = 0 retval = 1 saved_msg_list = 0x0 current_line = 0 fname = 0x0 breakpoint = 0x0 dbg_tick = 0x0 private_msg_list = 0x0 debug_saved = {trylevel = 0, force_abort = 0, caught_stack = 0x0, vv_exception = 0x0, vv_throwpoint = 0x0, did_emsg = 0, got_int = 0, need_rethrow = 0, check_cstack = 0, current_exception = 0x0} initial_trylevel = 0 next_cmdline = cmd_getline = 0x558b4125c7a0 cmd_cookie = 0x7ffd8bc5db80 real_cookie = getline_is_func = #24 0x0000558b4125adfd in apply_autocmds_group (event=EVENT_BUFREADPOST, fname=0x7fb9388c8040 "/usr/bin/inxi", fname_io=, force=, group=-3, buf=0x7fb9399bd060, eap=0x0, data=0x0) at /home/demon/src/neovim/src/nvim/autocmd.c:1844 nesting = 2 filechangeshell_busy = 0 save_redo = {sr_redobuff = {bh_first = {b_next = 0x0, b_str = ""}, bh_curr = 0x0, bh_index = 0, bh_space = 0}, sr_old_redobuff = {bh_first = {b_next = 0x0, b_str = ""}, bh_curr = 0x0, bh_index = 0, bh_space = 0}} save_current_sctx = {sc_sid = 0, sc_seq = 0, sc_lnum = 0} funccal_entry = {top_funccal = 0x0, next = 0x0} patcmd = {curpat = 0x7fb938ca20c0, nextcmd = 0x0, group = -3, fname = 0x7fb9388c8040 "/usr/bin/inxi", sfname = 0x7fb9388cd980 "/usr/bin/inxi", tail = 0x7fb9388c8049 "inxi", event = EVENT_BUFREADPOST, arg_bufnr = 1, data = 0x0, next = 0x0} save_KeyTyped = false sfname = 0x7fb9388cd980 "/usr/bin/inxi" retval = true did_save_redobuff = save_autocmd_fname = 0x0 save_autocmd_bufnr = 0 save_autocmd_match = 0x0 save_autocmd_busy = 0 old_curbuf = 0x7fb9399bd060 save_sourcing_name = 0x0 save_sourcing_lnum = 0 wait_time = tail = save_cmdbang = 0 save_cmdarg = 0x0 ap = save_autocmd_nested = save_changed = #25 0x0000558b41372d49 in apply_autocmds_exarg (event=EVENT_BUFREADPOST, fname=0x0, fname_io=0x0, force=false, buf=0x7fb9388b4380, eap=) at /home/demon/src/neovim/src/nvim/autocmd.c:1530 No locals. #26 readfile (fname=0x0, sfname=0x0, from=, lines_to_skip=, lines_to_read=, eap=, flags=, silent=) at /home/demon/src/neovim/src/nvim/fileio.c:1952 m = 0 n = 0 msg_is_a_directory = sha_ctx = {total = {967711868, 32697}, state = {4294967258, 0, 967658765, 32697, 965984336, 32697, 8191, 4096}, buffer = "\000\000\000\000\000\000\000\000\001", '\000' , "\355\201\000\000\307\f'\000\000\000\000\000\067:\021\000\000\000\000\000\240\b\000\000\000\000\000\000p0 \000\000\000\000\000\065Ǽb\000\000\000"} conv_rest = "\017\355\025A\213U\000\000\000\000\000\000\000\000\000\001\377\017\000\000\000\000\000\000\270\336ŋ\375\177" orig_start = {lnum = -1949966688, col = 32765, coladd = -1949966752} fd = set_options = read_buf_lnum = read_buf_col = lnum = ptr = buffer = new_buffer = line_start = size = p = filesize = skip_read = read_undo_file = split = error = ff_error = linerest = perm = swap_mode = fileformat = keep_fileformat = skip_count = read_count = msg_save = read_no_eol_lnum = 0 file_rewind = conv_error = illegal_byte = keep_dest_enc = bad_char_behavior = 63 tmpname = fio_flags = fenc_next = advance_fenc = real_size = did_iconv = converted = notconverted = conv_restlen = iconv_fd = old_curbuf = old_b_ffname = old_b_fname = using_b_ffname = using_b_fname = check_readonly = file_info = file_readonly = try_mac = try_dos = try_unix = linecnt = fenc = fenc_alloced = can_retry = len = c = newfile = filtering = read_stdin = read_buffer = read_fifo = wasempty = #27 0x0000558b4125f044 in open_buffer (read_stdin=0, eap=0x7fb9388b4380, flags=0) at /home/demon/src/neovim/src/nvim/buffer.c:233 save_bin = 0 perm = old_tw = read_fifo = 1 retval = 1 silent = old_curbuf = {br_buf = 0x7fb9399bd060, br_fnum = 1, br_buf_free_count = 0} #28 0x0000558b413c79cb in create_windows (parmp=0x7ffd8bc5e460) at /home/demon/src/neovim/src/nvim/main.c:1641 done = dorewind = 0 #29 main (argc=, argv=) at /home/demon/src/neovim/src/nvim/main.c:482 params = {argc = 2, argv = 0x7ffd8bc5e7d8, use_vimrc = 0x0, clean = false, n_commands = 0, commands = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, cmds_tofree = "\000\000\000\000\000\000\000\000\000", n_pre_commands = 0, pre_commands = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, edit_type = 1, tagname = 0x0, use_ef = 0x0, input_isatty = true, output_isatty = true, err_isatty = true, input_neverscript = false, no_swap_file = 0, use_debug_break_level = -1, window_count = 1, window_layout = 0, diff_mode = 0, listen_addr = 0x0, remote = 0, server_addr = 0x0} fname = cwd = 0x0 use_remote_ui = 144 use_builtin_ui = vimrc_none = ```

i'm not sure of the easiest way to reproduce it, but i can reproduce it with either git or latest (0.6.2) neovim, with nvim-treesitter installed as a plugin, and only the perl parser loaded. something like:

local execute = vim.api.nvim_command

require("plugins")
execute(":packloadall")

local ts_configs = require("nvim-treesitter.configs")

ts_configs.setup({
  ensure_installed = { "perl" },
  highlight = { enable = true, use_languagetree = true },
})

as .config/nvim/init.lua, and .config/nvim/lua/plugins.lua:

local execute = vim.api.nvim_command
local install_path = vim.fn.stdpath("data") .. "/site/pack/paqs/start/paq-nvim"

if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
  execute("!git clone --depth 1 https://github.com/savq/paq-nvim " .. install_path)
  execute("packadd paq-nvim")
end

local packages = {
  -- highlighting
  {
    "nvim-treesitter/nvim-treesitter",
    run = function()
      execute(":TSUpdate")
    end,
  },
}

return require("paq")(packages)

from there, you could start neovim, run :PaqSync (you need a c compiler and git installed), then it /should/ install the parser after, if not, :TSUpdate/:TSInstall perl would sync that

then, opening the above inxi perl file causes a segfault from this parser. apologies, i don't know of another way to use the parser in a more minimal reproduction

ptrcnull commented 2 years ago

here's the smallest perl script i could reproduce this issue with:

{
package UsbData;
my (@working);
sub set {
    eval $start if $b_log;
    ${$_[0]} = 1; # set checked boolean
    # note: bsd package usbutils has lsusb in it, but we dont want it for default
}

# get driver, interface [type:] data
sub uevent_data {
    foreach (@files){
        last if $b_hub;
        # print "f2: $_\n";
        ($interface) = ('');
        @working = main::reader($_) if -r $_;
    }
    return @drivers;
}
}

unfortunately, i couldn't get it to segfault using py-tree-sitter, it might be specific to how nvim-treesitter calls the library

ptrcnull commented 2 years ago

ah, it segfaults with just this:

$ tree-sitter generate
$ tree-sitter parse repr.pl
ganezdragon commented 1 year ago

I haven't used neovim, so let me try it out and see if it segfaults.

nekopsykose commented 1 year ago

the repro didn't require using neovim, just the above steps worked.

nevertheless, i can't reproduce this anymore (even on the older version at the time..). fun :)