nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.98k stars 837 forks source link

Segfault on every telescope prompt #1737

Closed Davincible closed 2 years ago

Davincible commented 2 years ago

Description

I am getting a segmentation fault every time I open any Telescope window. Worked fine previously

Neovim version

NVIM v0.7.0-dev+1042-g01b748f28
Build type: RelWithDebInfo
LuaJIT 2.0.5
Compilation: /sbin/cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions     -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security     -fstack-clash-protection -fcf-protection -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/tyler/.cache/yay/neovim-git/src/build/config -I/home/tyler/.cache/yay/neovim-git/src/neovim-git/src -I/usr/include -I/home/tyler/.cache/yay/neovim-git/src/build/src/nvim/auto -I/home/tyler/.cache/yay/neovim-git/src/build/include
Compiled by tyler@ANGELIQUE

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Operating system and version

Manjaro 5.15.19-1

checkhealth telescope

telescope: require("telescope.health").check()
========================================================================
## Checking for required plugins
  - OK: plenary installed.
  - OK: nvim-treesitter installed.

## Checking external dependencies
  - OK: rg: found ripgrep 13.0.0
  - OK: fd: found fd 8.3.2

## ===== Installed extensions =====

Steps to reproduce

Open any telescope menu

Expected behavior

No segfault

Actual behavior

segfault

Minimal config

local telescope = require('telescope')
local actions = require('telescope.actions')

require("trouble").setup()
local trouble = require("trouble.providers.telescope")

local M = {}

telescope.setup {
    defaults = {
        -- find_command = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case', '--max-depth 5'},
        prompt_prefix = " ",
        -- prompt_prefix = " ",
        selection_caret = " ",
        entry_prefix = "  ",
        initial_mode = "insert",
        -- initial_mode = "insert",
        selection_strategy = "reset",
        sorting_strategy = "descending",
        layout_strategy = "horizontal",
        layout_config = {
            prompt_position = "bottom",
            preview_cutoff = 120,
            horizontal = {width = 0.75, mirror = false}, 
            vertical   = {mirror = false}
        },
        file_sorter = require'telescope.sorters'.get_fzy_sorter,
        file_ignore_patterns = {
            "node_modules/",
            "vendor/",
            ".git/",
        },
        generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
        path_display = {'shorten'},
        winblend = 0,
        border = {},
        borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'},
        color_devicons = true,
        use_less = true,
        set_env = {['COLORTERM'] = 'truecolor'}, -- default = nil,
        file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
        grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
        qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,

        -- Developer configurations: Not meant for general override
        buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker,
        mappings = {
            i = {
                ["<C-c>"] = actions.close,
                ["<C-j>"] = actions.move_selection_next,
                ["<C-k>"] = actions.move_selection_previous,
                ["<c-t>"] = trouble.open_with_trouble,
                ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
                -- To disable a keymap, put [map] = false
                -- So, to not map "<C-n>", just put
                -- ["<c-x>"] = false,
                -- ["<esc>"] = actions.close,

                -- Otherwise, just set the mapping to the function that you want it to be.
                -- ["<C-i>"] = actions.select_horizontal,

                -- Add up multiple actions
                ["<CR>"] = actions.select_default + actions.center

                -- You can perform as many actions in a row as you like
                -- ["<CR>"] = actions.select_default + actions.center + my_cool_custom_action,
            },
            n = {
                ["<C-j>"] = actions.move_selection_next,
                ["<C-k>"] = actions.move_selection_previous,
                ["<c-t>"] = trouble.open_with_trouble,
                ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist
                -- ["<C-i>"] = my_cool_custom_action,
            }
        }
    },
    extensions = {fzy_native = {override_generic_sorter = false, override_file_sorter = true}}
}

-- require'telescope'.load_extension('project')

M.find_files = function()
    require("telescope.builtin").find_files {
        find_command = { 'fd', '--max-depth',  '5', '--hidden', '--follow', '--type', 'f' },
    }
end

vim.api.nvim_set_keymap('n', '<leader>ff', ':lua require("uno.telescope").find_files()<CR>',           {silent = true})
vim.api.nvim_set_keymap('n', '<leader>fg', ':lua require("telescope.builtin").live_grep()<CR>',        {silent = true})
vim.api.nvim_set_keymap('n', '<leader>fb', ':lua require("telescope.builtin").buffers()<CR>',          {silent = true})
vim.api.nvim_set_keymap('n', '<leader>ft', ':lua require("telescope.builtin").file_browser()<CR>',          {silent = true})
vim.api.nvim_set_keymap('n', '<leader>fh', ':lua require("telescope.builtin").help_tags()<CR>',        {silent = true})
vim.api.nvim_set_keymap('n', '<leader>fr', ':lua require("telescope.builtin").lsp_references()<CR>',   {silent = true})
vim.api.nvim_set_keymap('n', '<leader>fd', ':lua require("telescope.builtin").lsp_definitions()<CR>',  {silent = true})
vim.api.nvim_set_keymap('n', '<C-p>',      ':lua require("telescope.builtin").git_files()<CR>',        {silent = true})

return M
againxx commented 2 years ago

Same problem here. I experienced segfault when using grep_string. Here is the backtrace from the gdb

#0  0x00007fb391d13515 in __strlen_avx2 () from /usr/lib/libc.so.6
No symbol table info available.
#1  0x000055b0173cbf2b in lj_cf_ffi_string (L=0x7fb38ba2ca30) at lib_ffi.c:692
        cts = <optimized out>
        o = 0x7fb389750be0
        p = 0x0
        len = <optimized out>
#2  0x000055b0173cf786 in lj_BC_FUNCC ()
No symbol table info available.
#3  0x000055b0173d05bc in lj_ff_coroutine_resume ()
No symbol table info available.
#4  0x000055b0173bbd88 in lua_pcall (L=L@entry=0x7fb391f36380, nargs=nargs@entry=0, nresults=nresults@entry=0, errfunc=errfunc@entry=-2) at lj_api.c:1116
        g = 0x7fb391f363e0
        oldh = 0 '\000'
        ef = <optimized out>
        status = <optimized out>
        __func__ = "lua_pcall"
#5  0x000055b0172041a5 in nlua_pcall (lstate=lstate@entry=0x7fb391f36380, nargs=nargs@entry=0, nresults=nresults@entry=0) at /home/ustc-1314/Manually_Installed/neovim/src/nvim/lua/executor.c:100
        status = <optimized out>
#6  0x000055b01720b252 in nlua_schedule_event (argv=<optimized out>) at /home/ustc-1314/Manually_Installed/neovim/src/nvim/lua/executor.c:171
        cb = <optimized out>
        lstate = 0x7fb391f36380
#7  0x000055b0172e6099 in state_handle_k_event () at /home/ustc-1314/Manually_Installed/neovim/src/nvim/state.c:97
        event = {handler = 0x55b01720b21d <nlua_schedule_event>, argv = {0xf2, 0x7fb38ba2ca30, 0x55b0173c4be8 <trace_state+488>, 0x7fb38ba2ca30, 0x7fb389840b24, 0x7fb389840ab8, 0x7fb391f366b8, 0x7fb38ba2ca30, 0x7fb391f363e0, 0x7fb38bd99408}}
#8  0x000055b01715b2ff in insert_handle_key (s=s@entry=0x7ffeeaeb7ab0) at /home/ustc-1314/Manually_Installed/neovim/src/nvim/edit.c:1078
No locals.
#9  0x000055b01715bd47 in insert_execute (state=0x7ffeeaeb7ab0, key=<optimized out>) at /home/ustc-1314/Manually_Installed/neovim/src/nvim/edit.c:838
        s = 0x7ffeeaeb7ab0
#10 0x000055b0172e5f9b in state_enter (s=0x7ffeeaeb7ab0) at /home/ustc-1314/Manually_Installed/neovim/src/nvim/state.c:79
        check_result = <optimized out>
        key = <optimized out>
        execute_result = <optimized out>
#11 0x000055b01715507e in insert_enter (s=s@entry=0x7ffeeaeb7ab0) at /home/ustc-1314/Manually_Installed/neovim/src/nvim/edit.c:494
No locals.
#12 0x000055b0171553e6 in edit (cmdchar=97, startln=<optimized out>, count=1) at /home/ustc-1314/Manually_Installed/neovim/src/nvim/edit.c:1469
        state = {state = {check = 0x55b01715386a <insert_check>, execute = 0x55b01715b8a0 <insert_execute>}, ca = 0x0, mincol = 0, cmdchar = 97, cmdchar_todo = 0, startln = 0, count = 0, c = -26365, lastc = -26877, i = 0, did_backspace = false, 
          line_is_white = false, old_topline = 1, old_topfill = 0, inserted_space = 0, replaceState = 80, did_restart_edit = 0, nomove = false, ptr = 0x0}
        s = 0x7ffeeaeb7ab0
#13 0x000055b0172448ca in normal_finish_command (s=s@entry=0x7ffeeaeb7ba0) at /home/ustc-1314/Manually_Installed/neovim/src/nvim/normal.c:970
No locals.
#14 0x000055b01724a05a in normal_execute (state=0x7ffeeaeb7ba0, key=<optimized out>) at /home/ustc-1314/Manually_Installed/neovim/src/nvim/normal.c:1172
        s = 0x7ffeeaeb7ba0
        __PRETTY_FUNCTION__ = "normal_execute"
#15 0x000055b0172e5f9b in state_enter (s=0x7ffeeaeb7ba0) at /home/ustc-1314/Manually_Installed/neovim/src/nvim/state.c:79
        check_result = <optimized out>
        key = <optimized out>
        execute_result = <optimized out>
#16 0x000055b017241902 in normal_enter (cmdwin=<optimized out>, noexmode=<optimized out>) at /home/ustc-1314/Manually_Installed/neovim/src/nvim/normal.c:463
        state = {state = {check = 0x55b017244308 <normal_check>, execute = 0x55b017249a98 <normal_execute>}, command_finished = false, ctrl_w = false, need_flushbuf = false, set_prevcount = false, previous_got_int = false, cmdwin = false, 
          noexmode = false, toplevel = true, oa = {op_type = 0, regname = 0, motion_type = kMTLineWise, motion_force = 0, use_reg_one = false, inclusive = false, end_adjusted = false, start = {lnum = 0, col = 0, coladd = 0}, end = {lnum = 0, col = 0, 
              coladd = 0}, cursor_start = {lnum = 0, col = 0, coladd = 0}, line_count = 0, empty = false, is_VIsual = false, start_vcol = 0, end_vcol = 0, prev_opcount = 0, prev_count0 = 0, excl_tr_ws = false}, ca = {oap = 0x7ffeeaeb7bb8, prechar = 0, 
            cmdchar = -26877, nchar = 0, ncharC1 = 0, ncharC2 = 0, extra_char = 0, opcount = 0, count0 = 0, count1 = 1, arg = 0, retval = 0, searchbuf = 0x0}, mapped_len = 1, old_mapped_len = 0, idx = 185, c = 0, old_col = 27, old_pos = {lnum = 168, 
            col = 27, coladd = 0}}
#17 0x000055b017218732 in main (argc=<optimized out>, argv=<optimized out>) at /home/ustc-1314/Manually_Installed/neovim/src/nvim/main.c:557
        fname = 0x55b019388af0 "lua/xx/snippets/c.lua"
        params = {argc = 2, argv = 0x7ffeeaeb7f38, 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}
        cwd = 0x0
        use_remote_ui = false
        use_builtin_ui = true
        vimrc_none = <optimized out>
        __PRETTY_FUNCTION__ = "main"
againxx commented 2 years ago

FYI, changing back to release v0.6.1 seems fine.

Conni2461 commented 2 years ago

probably fixed by https://github.com/nvim-lua/plenary.nvim/pull/321

can someone confirm?

Davincible commented 2 years ago

Yup, fixed