tagbar icon indicating copy to clipboard operation
tagbar copied to clipboard

Tagbar doesn't populate, ctags.exe can't find file /tmp/vGCKBiZ/11.cs

Open Rimann91 opened this issue 3 years ago • 7 comments

The problem is exactly as the title states. I've pasted a debug log. Here is some info

  • Running vim on Windows Linux Subsystem
  • Set path to Ctags with the g:tagbar_ctags_bin variable which is on the C drive ('/mnt/c/path/to/ctags.exe')
  • Tagbar works when run on my vimrc which is on the WSL local file system ($HOME/.vim/vimrc)

3 VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 15 2020 06:40:31) 4 Included patches: 1-2269 5 Modified by [email protected] 6 Compiled by [email protected] 7 Huge version without GUI. Features included (+) or not (-): 8 +acl +byte_offset +conceal -ebcdic +folding +keymap +menu +mouse_sgr +packages +quickfix +startuptime +terminal +vartabs +windows 9 +arabic +channel +cryptv +emacs_tags -footer +lambda +mksession -mouse_sysmouse +path_extra +reltime +statusline +terminfo +vertsplit +writebackup 10 +autocmd +cindent +cscope +eval +fork() +langmap +modify_fname +mouse_urxvt -perl +rightleft -sun_workshop +termresponse +virtualedit -X11 11 +autochdir -clientserver +cursorbind +ex_extra +gettext +libcall +mouse +mouse_xterm +persistent_undo -ruby +syntax +textobjects +visual -xfontset 12 -autoservername -clipboard +cursorshape +extra_search -hangul_input +linebreak -mouseshape +multi_byte +postscript +scrollbind +tag_binary +textprop +visualextra -xim 13 -balloon_eval +cmdline_compl +dialog_con -farsi +iconv +lispindent +mouse_dec +multi_lang +printer +signs -tag_old_static +timers +viminfo -xpm 14 +balloon_eval_term +cmdline_hist +diff +file_in_path +insert_expand +listcmds +mouse_gpm -mzscheme +profile +smartindent -tag_any_white +title +vreplace -xsmp 15 -browse +cmdline_info +digraphs +find_in_path +job +localmap -mouse_jsbterm +netbeans_intg -python +sound -tcl -toolbar +wildignore -xterm_clipboard 16 ++builtin_terms +comments -dnd +float +jumplist -lua +mouse_netterm +num64 +python3 +spell +termguicolors +user_commands +wildmenu -xterm_save 17 system vimrc file: "$VIM/vimrc" 18 user vimrc file: "$HOME/.vimrc" 19 2nd user vimrc file: "~/.vim/vimrc" 20 user exrc file: "$HOME/.exrc" 21 defaults file: "$VIMRUNTIME/defaults.vim" 22 fall-back for $VIM: "/usr/share/vim" 23 Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -fdebug-prefix-map=/build/vim-iU6mZD/vim-8.1.2269=. -fstack-protector-strong -Wformat -Werror=format-security -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 24 Linking: gcc -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -lcanberra -lacl -lattr -lgpm -ldl -L/usr/lib/python3.8/config-3.8-x86_64-linux-gnu -lpython3.8 -lcrypt -lpthread -ldl -lutil -lm -lm 202 0-12-28 21:51:04.446058: OpenWindow called with flags: '' 25 2020-12-28 21:51:04.447646: goto_win(): wincmd p, 1 26 2020-12-28 21:51:04.448608: goto_win(): wincmd p, 1 27 2020-12-28 21:51:04.475450: AutoUpdate called [/mnt/c/Users/riman/source/repos/CoinbaseMonitor/Tagbar.1] 28 2020-12-28 21:51:04.476396: Still opening window, stopping processing 29 2020-12-28 21:51:04.488922: InitWindow called with autoclose: 0 30 2020-12-28 21:51:04.506636: AutoUpdate called [/mnt/c/Users/riman/source/repos/CoinbaseMonitor/Tagbar.1] 31 2020-12-28 21:51:04.507629: In Tagbar window, stopping processing 32 2020-12-28 21:51:04.517706: Mapping keys 33 2020-12-28 21:51:04.520122: InitWindow finished 34 2020-12-28 21:51:04.521084: Removing fileinfo for [/mnt/c/Users/riman/source/repos/CoinbaseMonitor/CoinbaseMonitor/ViewModels/WalletControlViewModel.cs] 35 2020-12-28 21:51:04.521837: AutoUpdate called [/mnt/c/Users/riman/source/repos/CoinbaseMonitor/CoinbaseMonitor/ViewModels/WalletControlViewModel.cs] 36 2020-12-28 21:51:04.522529: Vim filetype: 'cs', sanitized filetype: 'cs' 37 2020-12-28 21:51:04.523197: Checking if file is valid [/mnt/c/Users/riman/source/repos/CoinbaseMonitor/CoinbaseMonitor/ViewModels/WalletControlViewModel.cs] 38 2020-12-28 21:51:04.524117: New file, processing [/mnt/c/Users/riman/source/repos/CoinbaseMonitor/CoinbaseMonitor/ViewModels/WalletControlViewModel.cs] 39 2020-12-28 21:51:04.524776: ProcessFile called [/mnt/c/Users/riman/source/repos/CoinbaseMonitor/CoinbaseMonitor/ViewModels/WalletControlViewModel.cs] 40 2020-12-28 21:51:04.525417: Checking if file is valid [/mnt/c/Users/riman/source/repos/CoinbaseMonitor/CoinbaseMonitor/ViewModels/WalletControlViewModel.cs] 41 2020-12-28 21:51:04.526712: typeinfo for file to process: {'ctagstype': 'c#', 'ftype': 'cs', 'kinddict': {'s': 8, 'p': 11, 'c': 7, 'd': 0, 'e': 3, 'f': 1, 'g': 2, 't': 4, 'i': 6, '?': 12, 'm': 10, 'n': 5, 'E': 9}, 'sro': '.', 'createKinddict': function('<SNR>112_createK inddict'), 'getKind': function('<SNR>112_getKind'), 'kind2scope': {'s': 'struct', 'c': 'class', 'g': 'enum', 'i': 'interface', 'n': 'namespace', '?': 'unknown'}, 'scope2kind': {'enum': 'g', 'interface': 'i', 'namespace': 'n', 'class': 'c', 'struct': 's'}, 'kinds': [{'sh ort': 'd', 'long': 'macros', 'fold': 1, 'stl': 0}, {'short': 'f', 'long': 'fields', 'fold': 0, 'stl': 1}, {'short': 'g', 'long': 'enums', 'fold': 0, 'stl': 1}, {'short': 'e', 'long': 'enumerators', 'fold': 0, 'stl': 0}, {'short': 't', 'long': 'typedefs', 'fold': 0, 'stl ': 1}, {'short': 'n', 'long': 'namespaces', 'fold': 0, 'stl': 1}, {'short': 'i', 'long': 'interfaces', 'fold': 0, 'stl': 1}, {'short': 'c', 'long': 'classes', 'fold': 0, 'stl': 1}, {'short': 's', 'long': 'structs', 'fold': 0, 'stl': 1}, {'short': 'E', 'long': 'events', 'fold': 0, 'stl': 1}, {'short': 'm', 'long': 'methods', 'fold': 0, 'stl': 1}, {'short': 'p', 'long': 'properties', 'fold': 0, 'stl': 1}, {'short': '?', 'long': 'unknown', 'fold': 0, 'stl': 1}]} 42 2020-12-28 21:51:04.527541: Caching file into: /tmp/vGCKBiZ/11.cs 43 2020-12-28 21:51:04.533301: ExecuteCtagsOnFile called [/tmp/vGCKBiZ/11.cs] 44 2020-12-28 21:51:04.534507: EscapeCtagsCmd called 45 2020-12-28 21:51:04.535167: ctags_bin: /mnt/c/users/riman/.vim/ctags/ctags.exe 46 2020-12-28 21:51:04.535787: ctags_args (is a list): ['--extras=+F', '-f', '-', '--format=2', '--excmd=pattern', '--fields=nksSafet', '--sort=no', '--append=no', '-V', '--language-force=c#', '--c#-kinds=dfgetnicsEmp'] 47 2020-12-28 21:51:04.536578: Escaped ctags command: '/mnt/c/users/riman/.vim/ctags/ctags.exe' '--extras=+F' '-f' '-' '--format=2' '--excmd=pattern' '--fields=nksSafet' '--sort=no' '--append=no' '-V' '--language-force=c#' '--c#-kinds=dfgetnicsEmp' '/tmp/vGCKBiZ/11.cs' 48 2020-12-28 21:51:04.537382: Executing ctags command: '/mnt/c/users/riman/.vim/ctags/ctags.exe' '--extras=+F' '-f' '-' '--format=2' '--excmd=pattern' '--fields=nksSafet' '--sort=no' '--append=no' '-V' '--language-force=c#' '--c#-kinds=dfgetnicsEmp' '/tmp/vGCKBiZ/11.cs' 49 2020-12-28 21:51:04.590716: Calling shell to execute: "('/mnt/c/users/riman/.vim/ctags/ctags.exe' '--extras=+F' '-f' '-' '--format=2' '--excmd=pattern' '--fields=nksSafet' '--sort=no' '--append=no' '-V' '--language-force=c#' '--c#-kinds=dfgetnicsEmp' '/tmp/vGCKBiZ/11.cs ')>/tmp/vGCKBiZ/12 2>&1" 50 2020-12-28 21:51:04.591847: Exit code: 0 51 2020-12-28 21:51:04.650570: Command output: 52 2020-12-28 21:51:04.652338: Option: --language-force=c#^M 53 Option: --c#-kinds=dfgetnicsEmp^M 54 Initialize parser: C#^M 55 Reading command line arguments^M 56 ctags.exe: Warning: cannot open input file "/tmp/vGCKBiZ/11.cs" : No such file or directory^M

Rimann91 avatar Dec 29 '20 04:12 Rimann91

This looks like a permission problem with your /tmp directory. If you have the same setup on a different computer maybe compare notes on what permissions that directory has and whether your user can create new directories inside that.

alerque avatar Dec 29 '20 06:12 alerque

@alerque I just checked, i have read write and execute permissions on the tmp folder on both machines. I also tested and created a directory and a file to make sure. Also, I was mistaken, this doesn not work on either of my machines, I just tested the other one again and I must have only tried on the WLS side of that one before. The problem only occurs when trying to use tagbar on the mounted C drive

Rimann91 avatar Dec 29 '20 14:12 Rimann91

Is your gotags (or ctags if that's what is getting executed) installed via Snap, Flatpack, or some other containerized package system? This sounds like a security ACL of some kind kicking in prohibiting the process access to the file system even when your user could otherwise do so.

alerque avatar Dec 29 '20 20:12 alerque

No downloaded a release directly from here https://github.com/universal-ctags/ctags-win32/releases Snap currently isn't supported by WLS

Rimann91 avatar Dec 29 '20 21:12 Rimann91

I'm sorry I'm not much more use here, I really don't know what the issues is and without a Windows machine or any experience with the latest generation of WLS I really don't know where to go from here. We need input from someone with the right experience.

alerque avatar Jan 11 '21 07:01 alerque

@Rimann91 as a workaround, does it work if you change your $TMP or $TMPDIR environment variable to something else? From other similar file system errors with the /tmp path from other vim scripts / plugins, I've seen people recommend adding something like the following in the .vimrc file to change the tempname() result.

For Linux:

let $TMPDIR=$HOME . '/tmp'

For Windows (at least I think you need to use a \ instead of /, though might need to escape it if this doesn't work directly... don't have windows vim setup to test it):

let $TMP=$HOME . '\tmp'

If this does work, then we can document this as a solution to change your tmp directory for vim. Note this does change the behavior of vim when using tempname(). See :h tempfile or :h tempname for more info.

raven42 avatar Jan 11 '21 13:01 raven42

I was having the same problem on my Ubuntu 18.04 box. Golang files would show in tagbar, but not Makefile targets. I have complex Makefiles.

Adding let $TMPDIR=$HOME . '/tmp' fixed it. Thank you @raven42 .

I would see an error referring to /tmp/vLI6Gek/14. I had no such file. I did have a /tmp/vLI6Gek/1

╰─➤  alias cat
cat=/usr/games/lolcat

╰─➤  ls -ald /tmp/vlhvgk7
drwx------ 2 sqqqrly sqqqrly 4096 Jan 26 19:33 /tmp/vlhvgk7

╰─➤  ls -l /tmp/vLI6Gek/1
srwxrwxr-x 1 sqqqrly sqqqrly 0 Jan 31 15:33 /tmp/vLI6Gek/1

╰─➤  cat /tmp/vLI6Gek/1
Traceback (most recent call last):
        5: from /usr/games/lolcat:24:in `<main>'
        4: from /usr/lib/ruby/vendor_ruby/lolcat/cat.rb:107:in `cat!'
        3: from /usr/lib/ruby/vendor_ruby/lolcat/cat.rb:107:in `each'
        2: from /usr/lib/ruby/vendor_ruby/lolcat/cat.rb:110:in `block in cat!'
        1: from /usr/lib/ruby/vendor_ruby/lolcat/cat.rb:110:in `open'
/usr/lib/ruby/vendor_ruby/lolcat/cat.rb:110:in `initialize': No such device or address @ rb_sysopen - /tmp/vLI6Gek/1 (Errno::ENXIO)

sqqqrly avatar Jan 31 '23 16:01 sqqqrly