tweekmonster / deoplete-clang2

MIT License
90 stars 17 forks source link

Permission denied error? #25

Open phcerdan opened 6 years ago

phcerdan commented 6 years ago

Same setup works with deoplete-clang but not here. I was just triggering asking for autocompletions after std:: using clang 5.0 in arch


[deoplete] Traceback (most recent call last):
[deoplete]   File "/home/phc/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 136, in gather_results
[deoplete]     ctx['candidates'] = source.gather_candidates(ctx)
[deoplete]   File "/home/phc/.vim/plugged/deoplete-clang2/rplugin/python3/deoplete/sources/deoplete_clang2.py", line 662, in gather_candidates
[deoplete]     cmd, flags = self.build_flags(context)
[deoplete]   File "/home/phc/.vim/plugged/deoplete-clang2/rplugin/python3/deoplete/sources/deoplete_clang2.py", line 505, in build_flags
[deoplete]     flags = self.get_clang_flags(lang) + flags
[deoplete]   File "/home/phc/.vim/plugged/deoplete-clang2/rplugin/python3/deoplete/sources/deoplete_clang2.py", line 226, in get_clang_flags
[deoplete]     stdout = self.call_clang([], clang_flags, True)
[deoplete]   File "/home/phc/.vim/plugged/deoplete-clang2/rplugin/python3/deoplete/sources/deoplete_clang2.py", line 303, in call_clang
[deoplete]     stderr=subprocess.PIPE, cwd=cwd)
[deoplete]   File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
[deoplete]     restore_signals, start_new_session)
[deoplete]   File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
[deoplete]     raise child_exception_type(errno_num, err_msg, err_filename)
[deoplete] PermissionError: [Errno 13] Permission denied: ''
[deoplete] Could not get completions from: clang2.  Use :messages for error details.
`
anjos commented 6 years ago

I can reproduce this error in my setup. If I print the contents of line 303, just before execution, I get this:

['', '-fsyntax-only', '-x', 'c', '-', '-v'] #value of variable "cmd"

So, no surprise that the execution fails. I wonder why the variable self.clang_path is not properly set though.

Shougo commented 6 years ago

self.clang_path is initialized to '' in the constructor.

And it is set in on_event().

https://github.com/tweekmonster/deoplete-clang2/blob/787dd4dc7eeb5d1bc2fd3cefcf7bd07e48f4a962/rplugin/python3/deoplete/sources/deoplete_clang2.py#L147

If on_event() is not called, it will be ''. So no surprising.

anjos commented 6 years ago

What are possible causes of this issue? My configuration reads like this:

"configuration for deoplete-clang2
let g:deoplete#sources#clang#flags=['-darwin=10.13']
let g:deoplete#sources#clang#std={'c': 'c11', 'cpp': 'c++1z'}
anjos commented 6 years ago

I put a break point on on_event(), but as completion is triggered, this function is never called, so the value of clang_path does not get set.

Shougo commented 6 years ago

I think self.clang_path should be set in the constructor.

anjos commented 6 years ago

I tried this, but no luck - I continue to have the same error. It would be great if somebody could propose a serious patch here. Are we the only affected people? Is this plugin still being maintained?

Shougo commented 6 years ago

The plugin is still maintained. But the author seems busy. I have created another source plugin.

https://github.com/Shougo/deoplete-clangx

wsdjeg commented 6 years ago

@phcerdan can you post your clang version? or your os info, I also use arch, but I can not reproduce this issue.