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

Being spammed with errors when opening a file as sudo #44

Closed
farzadmf opened this issue Jun 9, 2021 · 11 comments
Closed

Being spammed with errors when opening a file as sudo #44

farzadmf opened this issue Jun 9, 2021 · 11 comments

Comments

@farzadmf
Copy link

farzadmf commented Jun 9, 2021

Describe the bug
I'm on Archlinux and opening sudo nvim /etc/pacman.conf (which is owned by root), and ultest is spamming me with errors. For every motion that I do, I'm getting an error:

Error detected while processing function ultest#handler#get_nearest_test[1]..<SNR>503_Call[3].._ultest_get_nearest_test[1]..remote#define#request:
line    2:
Error invoking '/home/farzad/.vim/plugged/vim-ultest/rplugin/python3/ultest:function:_ultest_get_nearest_test' on channel 10 (python3-rplugin-host):^@no request handler registered for "/home/farzad/.vim/plugged/vim-ultest/rplugin/python3/ultest:function:_ultest_get_nearest_test"

I didn't create a log, but let me know if that would help and I can try to create one.

To Reproduce
Open a file with sudo and see the errors

Expected behavior
Errors should be handled gracefully and not interfere with file navigation

@rcarriga
Copy link
Owner

rcarriga commented Jun 9, 2021

You might need to tell me more info about your setup, how is your config being loaded when you're using sudo? Normally you have to supply -E to sudo to use your own config, which works perfectly fine for me (on Arch as well). Could you also paste the output of stat /tmp/vim-ultest.log?

@farzadmf
Copy link
Author

farzadmf commented Jun 9, 2021

I'm also using sudo -E, but unfortunately, it seems to be not 100% reproducible 🙁

I'll try to see if I can find the steps to reproduce, but don't you think it's better to handle the errors more gracefully so that, in case they happen, they don't interfere with usage like this?

(or maybe I'm stupid and that's what is already happening, and this is coming from something else)

rcarriga added a commit that referenced this issue Jun 9, 2021
@rcarriga
Copy link
Owner

rcarriga commented Jun 9, 2021

Sure, I've added a catch for all errors, please try with the latest commit

@frbaroni
Copy link

frbaroni commented Jun 10, 2021

Part of the spam was two subsequent endtry in handler.vim:

diff --git a/autoload/ultest/handler.vim b/autoload/ultest/handler.vim
index 2885f68..8bdefb5 100644
--- a/autoload/ultest/handler.vim
+++ b/autoload/ultest/handler.vim
@@ -24,7 +24,6 @@ function! s:Call(func, args) abort
         let s:update_warn_sent += 1
       endif
     endtry
-    endtry
   else

Still not working, and I'm not involving sudo/su

Error: vim-ultest encountered an unknown error on startup, check v:exception                             
no notification handler registered for "/home/usr/dotfiles/vim/plugged/vim-ultest/rplugin/python3/ul
test:function:_ultest_update_positions"                                                                  
Press ENTER or type command to continue      

@seblj
Copy link

seblj commented Jun 10, 2021

I have the same issue. An example of when the problem happens is if I open a buffer inside the /usr/local/share/nvim/runtime/syntax folder

@rcarriga
Copy link
Owner

Yep totally fat fingered that one 😅 Please try the latest commit

@seblj
Copy link

seblj commented Jun 10, 2021

It fixes the worst part, but it's still echoing a message Error: vim-ultest remote function not detected, try running :UpdateRemotePlugins on install/update. I have tried using UpdateRemotePlugins several times, but it doesn't stop echoing the message

@rcarriga
Copy link
Owner

@farzadmf I managed to reproduce and find the issue. The problem was a file permissions error with the default log file when switching between root and your user.

@seblj That seems to be a different issue because it's triggering the old catch, can you check with the latest commit and if it's not fixed open a separate issue with more details?

@seblj
Copy link

seblj commented Jun 10, 2021

I thought it fixed that issue at first since I got a new message saying: Error: vim-ultest encountered an unknown error on startup, check v:exception. But I tried to run :UpdateRemotePlugins again, but it now prints the same message as before. I can open a separate issue on this

@farzadmf
Copy link
Author

Thank you @rcarriga for the super fast updates

I updated the plugins, and I'll be testing, I hope I don't get the error 🤞 , but if I do, I'll update you for sure

@farzadmf
Copy link
Author

Hey @rcarriga

Now I'm facing the same issue as @frbaroni mentioned: I've installed the vim-dirdiff plugin, and I'm opening two directories using nvim +"DirDiff <...dir1...> <...dir2...>", and I see the following error right off the bat:

no notification handler registered for "/home/farzad/.vim/plugged/vimultest/rplugin/python3/ultest:function:_ultest_update_positions"

Didn't include the logs because I thought the error itself might include a clue to a missing except somewhere, but let me know if you need more information and I'll try to gather more info

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

4 participants