deoplete-clang2 icon indicating copy to clipboard operation
deoplete-clang2 copied to clipboard

Permission denied error?

Open phcerdan opened this issue 7 years ago • 8 comments

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.
`

phcerdan avatar Dec 08 '17 02:12 phcerdan

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.

anjos avatar Mar 06 '18 01:03 anjos

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.

Shougo avatar Mar 06 '18 01:03 Shougo

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 avatar Mar 06 '18 11:03 anjos

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.

anjos avatar Mar 06 '18 11:03 anjos

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

Shougo avatar Mar 07 '18 01:03 Shougo

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?

anjos avatar Mar 08 '18 15:03 anjos

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

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

Shougo avatar Mar 12 '18 08:03 Shougo

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

wsdjeg avatar Mar 12 '18 11:03 wsdjeg