mileszs / ack.vim

Vim plugin for the Perl module / CLI script 'ack'
Other
3.08k stars 396 forks source link

Error detected while processing function ack#Ack[41] #250

Open astavonin opened 6 years ago

astavonin commented 6 years ago

Configuration:

In Vim I'm executing:

:Ack something

Log file:

Searching ...
Error detected while processing function ack#Ack[41]..<SNR>86_SearchWithGrep:
line    8:
E40: Can't open errorfile C:\Users\ASTAVO~1\AppData\Local\Temp\nvimEjmCaX\0
Error detected while processing function ack#Ack:
line   41:
E171: Missing :endif
Press ENTER or type command to continue

I can help with debugging or provide any extra information, if it'll help.

hachreak commented 6 years ago

I have the same issue but I'm working with debian 9.5 with vim 8, ack 2.15.

Drainful commented 6 years ago

I have the same issue as well. I have identical specs to astavonin.

halas commented 6 years ago

Same here, the same specs as hachreak

drmikehenry commented 6 years ago

An :Ack invocation uses :grep under the hood. When Vim executes :grep, it creates a temporary file to hold the results, runs the program, parses the temporary file to get the search results into the QuickFix window, and deletes the temporary file. I'm guessing these searches are finding some matches outside the temporary directory and writing them into the temporary file, then searching inside the temporary directory and finding additional matches in the temporary results file. Before the results can be used, however, Vim deletes the temporary file. :Ack without ! jumps to the first match which happens to be the now-deleted temporary file, causing the E40 error. This error is not handled in ack.vim (other than a try/finally to restore grepprg and grepformat), so the exception leaves SearchWithGrep() and ack#Ack() without getting a chance to execute the endif shown below, causing the additional E171 error: https://github.com/mileszs/ack.vim/blob/36e40f9ec91bdbf6f1adf408522a73a6925c3042/autoload/ack.vim#L60

If this is indeed the problem, it can be verified by using :Ack! something to prevent jumping to the first result, then examining the list of results in the QuickFix window. Configuring Ack to avoid searching in temporary directories should avoid this problem as well as make the search more efficient.

jdhao commented 5 years ago

I am using ag with ack.vim on CentOS . Exactly same issue here. The error only occurs for some search.

madalinpopa commented 5 years ago

Hi guys, How did you overcome this issue? I have the same issue on Windwos 10.

jdhao commented 5 years ago

@ppmadalin I am also using Neovim on Windows. I have changed to use LeaderF which is using ripgrep for fast greping in your current project. You can give it try.

madalinpopa commented 5 years ago

Great. I think I will do the same. 😐😬

neelkarma commented 3 years ago

This may be a duplicate of #169