nvim-telescope / telescope-fzf-native.nvim

FZF sorter for telescope written in c
1.38k stars 45 forks source link

seqmentation fault code dumed #2

Closed seocamo closed 3 years ago

seocamo commented 3 years ago

while i use grep with this plugin with this command :lua require("telescope.builtin").grep_string({previewer = false, only_sort_text = true, cmd = os.getenv("CD"), search = vim.fn.input("Grep For > ")})

i am testing in the moodle src code for a project with 27k files and i try to search with grep and type html and then in the result window type html and nvim core dumped

seqmentation fault (code dumed)

what do you need more ? ps. the src for moodle can be found in https://download.moodle.org/releases/latest

seocamo commented 3 years ago

i really want this plugin to just work, so i will try to test any thing i can think of to help out :)

Conni2461 commented 3 years ago

:laughing: i knew it. tj and were running it for 3 days without segfaults. I will look into it

Conni2461 commented 3 years ago

what is this opt: cmd = os.getenv("CD")

seocamo commented 3 years ago

it to force the root folder, some time telescope use my home folder as root altho i am in a project folder with nvim, this force the root to the same folder as nvim

seocamo commented 3 years ago

and i still got the previewer = false because of the memlack, i need to find out if that is needed any more

seocamo commented 3 years ago

but it fail with this too :lua require("telescope.builtin").grep_string({search = vim.fn.input("Grep For > ")})

Conni2461 commented 3 years ago

sorry i haven't fixed the out of memory previewer issue :| but i got somewhere here. try this: it disables the memory hack that makes the fuzzy_finding allocation free. I will find a proper solution for this. :) Because this makes it faster

diff --git a/lua/telescope/_extensions/fzf.lua b/lua/telescope/_extensions/fzf.lua
index 82395cc..c80ed04 100644
--- a/lua/telescope/_extensions/fzf.lua
+++ b/lua/telescope/_extensions/fzf.lua
@@ -33,14 +33,14 @@ local get_fzf_sorter = function(opts)

   return sorters.Sorter:new{
     init = function(self)
-      self.state.slab = fzf.allocate_slab()
+      -- self.state.slab = fzf.allocate_slab()
       self.state.prompt_cache = {}
     end,
     destroy = function(self)
       for _, v in pairs(self.state.prompt_cache) do
         fzf.free_pattern(v)
       end
-      fzf.free_slab(self.state.slab)
+      -- fzf.free_slab(self.state.slab)
     end,
     start = function(self, prompt)
       get_struct(self, prompt)
seocamo commented 3 years ago

yes this fix the problem, but if i search on html in the start i can't filter the result list on the file path(ex. block/html/index.php), is this a side effect ?

Conni2461 commented 3 years ago

only_sort_text = true disables sorting for filepath. I only calculate the score for the input. telescope gives me the input :laughing:

seocamo commented 3 years ago

damn i forgot i was playing with that :D sorry

Conni2461 commented 3 years ago

okay that feels sooooo bad. I disabled slab for now to make it work. I found some issues but not that bug. I looked at core dumps, valgrind and more nothing really fixed that issue. I spend more time on it this in the next few days.

Stuff like this just happens when you port fzf in 6 days :rofl: thanks for reporting tho :)

Conni2461 commented 3 years ago

It was this copy pasta mistake: https://github.com/nvim-telescope/telescope-fzf-native.nvim/commit/19feb8490707d813b1abee5634da067265ceb9b8#diff-04fb1c1d20a3169431c5f40cd338230f2ea66a4b6e7c442684986744c7b18e9aL1189-R1185

I enabled slab again and refactored some things :) hope this segfault is fixed. Thanks for reporting :)