xolox / vim-easytags

Automated tag file generation and syntax highlighting of tags in Vim
http://peterodding.com/code/vim/easytags/
1.01k stars 109 forks source link

Asynchronous tag updates (attempt two) doesn't work on Windows due to double quote escaping issue. #85

Open inkarkat opened 10 years ago

inkarkat commented 10 years ago

First, thanks for attacking the merge of sync and async modes in #84; you did really well, and I especially like the fact that you've pulled out the generic functionality into vim-misc! As promised, I'm alpha-testing this, mainly on Windows. The synchronous update works fine, but the asynchronous invocation fails; the forked Vim fails with:

Error detected while processing pre-vimrc command line:
E115: Missing quote: 'ctags --fields=+l --c-kinds=+p --c++-kinds=+p --sort=no -f-

I think this is caused by improper handling of the double quotes (indeed a hairy problem in the Windows shell). Here's the full command invocation for reference (captured via Process Explorer):

"C:\Program Files\vim\vim\gvim.exe" -u NONE -U NONE --noplugin -n -N -i NONE --cmd "let &rtp = 'D:/A/.vim,C:\Program Files\vim\vim/vimfiles,C:\Program Files\vim\vim,C:\Program Files\vim\vim/vimfiles/after,D:/A/.vim/after' | call xolox#misc#async#inside_child({'number': 1, 'function': 'xolox#easytags#update#with_vim', 'servername': 'GVIM', 'callback': 'xolox#easytags#async_callback', 'arguments': [{'tagsfile': '\A\.vim\tags', 'have_args': 0, 'default_filetype': 'vim', 'ctags_version': '5.8', 'filter_tags': 1, 'command': 'ctags --fields=+l --c-kinds=+p --c++-kinds=+p --sort=no -f- ""--language-force=vim"" ""D:\A\.vim\autoload\xolox\easytags.vim""'}]})"

The culprit is the ""; it may need to be ^", or whatever craziness Windows thinks is right :-( You should be able to write a simple test just for the vim-misc async function, bypassing all the easytags complexity (and so this issue might actually be against vim-misc, not easytags). A workaround might be to allow passing a List as the 'command' property, and only assembling (and shellescape()ing) this in the fork.

For completeness, here are my settings; I see this in both Vim 7.4.316 and 7.3.823.

:set shellcmdflag? shellquote? shellxquote? shellxescape?
shellcmdflag=/c
shellquote=
shellxquote=(
shellxescape="&|<>()@^
QMonkey commented 7 years ago

Same problem!

matt-hires commented 7 years ago

Same here :(

run2cmd commented 6 years ago

Looks to be that there is still issue with async. I'm using Vim 8.0 and async does not work for me.

Messages maintainer: Bram Moolenaar <Bram@vim.org>
"c:\code\puppet\ilottery_profile\manifests\db2.pp" [unix] 26L, 381C
vim-misc 1.17.6: Generated asynchronous Vim command #1: let &rtp = 'C:\Users\pbugala/vimfiles,C:\Users\pbugala\.vim\bundle\ide.vim,C:\Users\pbugala\.vim\bundle\Vundle.vim,C:\Users\pbugala\.vim\bundle\vim-puppet,C:\Users\pbugala\.vim\bundle\vim-fugitive,C:\Users\pbugala\.vim\bundle\vim-unimpaired,C:\Users\pbugala\.vim\bundle\vim-surround,C:\Users\pbugala\.vim\bundle\vim-easytags,C:\Users\pbugala\.vim\bundle\vim-misc,C:\Users\pbugala\.vim\bundle\vim-shell,C:\Users\pbugala\.vim\bundle\ale,C:\Users\pbugala\.vim\bundle\ctrlp.vim,C:\Users\pbugala\.vim\bundle\vim-tasks,C:\Users\pbugala\.vim\bundle\vim-gitgutter,C:\Users\pbugala\.vim\bundle\tabular,C:\Users\pbugala\.vim\bundle\vim-multiple-cursors,C:\Users\pbugala\.vim\bundle\vim-markdown,C:\Users\pbugala\.vim\bundle\indentLine,C:\Users\pbugala\.vim\bundle\xml.vim,C:\Users\pbugala\.vim\bundle\matchit,C:\Users\pbugala\.vim\bundle\vim-ruby,C:\Users\pbugala\.vim\bundle\ruby-matchit,C:\Users\pbugala\.vim\bundle\vim-rspec,C:\Program Files (x86)\vim/vimfiles,C:\Program Files (x86)\vim\vim80,C:\Program Files (x86)\vim/vimfiles/after,C:\Users\pbugala/vimfiles/after,C:\Users\pbugala/.vim/bundle/vundle,C:\Users\pbugala\.vim\bundle\ide.vim/after,C:\Users\pbugala\.vim\bundle\Vundle.vim/after,C:\Users\pbugala\.vim\bundle\vim-puppet/after,C:\Users\pbugala\.vim\bundle\vim-fugitive/after,C:\Users\pbugala\.vim\bundle\vim-unimpaired/after,C:\Users\pbugala\.vim\bundle\vim-surround/after,C:\Users\pbugala\.vim\bundle\vim-easytags/after,C:\Users\pbugala\.vim\bundle\vim-misc/after,C:\Users\pbugala\.vim\bundle\vim-shell/after,C:\Users\pbugala\.vim\bundle\ale/after,C:\Users\pbugala\.vim\bundle\ctrlp.vim/after,C:\Users\pbugala\.vim\bundle\vim-tasks/after,C:\Users\pbugala\.vim\bundle\vim-gitgutter/after,C:\Users\pbugala\.vim\bundle\tabular/after,C:\Users\pbugala\.vim\bundle\vim-multiple-cursors/after,C:\Users\pbugala\.vim\bundle\vim-markdown/after,C:\Users\pbugala\.vim\bundle\indentLine/after,C:\Users\pbugala\.vim\bundle\xml.vim/after,C:\Users\pbugala\.vim\bundle\matchit/after,C:\Users\pbugala\.vim\bundle\vim-ruby/after,C:\Users\pbugala\.vim\bundle\ruby-matchit/after,C:\Users\pbugala\.vim\bundle\vim-rspec/after,C:\Users\pbugala\.vim\bundle\ale/after' | call xolox#misc#async#inside_child({'number': 1, 'function': 'xolox#easytags#update#with_vim', 'servername': 'GVIM1', 'callback': 'xolox#easytags#async_callback', 'arguments': [{'directory': 'C:\Users\pbugala\.vim\tags', 'filetypes': {'c#': 'cs', 'asp': 'aspvbs', 'c++': 'cpp'}, 'have_args': 0, 'default_filetype': 'puppet', 'ctags_version': 'Development', 'filter_tags': 1, 'command': 'c:\git-sdk-64\mingw64\bin\ctags.exe --fields=+l --c-kinds=+p --c++-kinds=+p --sort=no -f- "--language-force=puppet" "c:\code\puppet\ilottery_profile\manifests\db2.pp"'}], 'starttime': ['xolox#misc#timer#value', [32, 502119976]]})
vim-misc 1.17.6: Looking for Vim executable named 'vim' on search path ..
vim-misc 1.17.6: Found 1 candidate(s) on search path: ['C:\Program Files (x86)\vim\vim80\vim.EXE'].
vim-misc 1.17.6: Reporting Vim executable 'C:\Program Files (x86)\vim\vim80\vim.EXE'.
vim-misc 1.17.6: Generated asynchronous shell command #1: "C:\Program Files (x86)\vim\vim80\vim.EXE" -u NONE -U NONE --noplugin -n -N -i NONE --cmd "let &rtp = 'C:\Users\pbugala/vimfiles,C:\Users\pbugala\.vim\bundle\ide.vim,C:\Users\pbugala\.vim\bundle\Vundle.vim,C:\Users\pbugala\.vim\bundle\vim-puppet,C:\Users\pbugala\.vim\bundle\vim-fugitive,C:\Users\pbugala\.vim\bundle\vim-unimpaired,C:\Users\pbugala\.vim\bundle\vim-surround,C:\Users\pbugala\.vim\bundle\vim-easytags,C:\Users\pbugala\.vim\bundle\vim-misc,C:\Users\pbugala\.vim\bundle\vim-shell,C:\Users\pbugala\.vim\bundle\ale,C:\Users\pbugala\.vim\bundle\ctrlp.vim,C:\Users\pbugala\.vim\bundle\vim-tasks,C:\Users\pbugala\.vim\bundle\vim-gitgutter,C:\Users\pbugala\.vim\bundle\tabular,C:\Users\pbugala\.vim\bundle\vim-multiple-cursors,C:\Users\pbugala\.vim\bundle\vim-markdown,C:\Users\pbugala\.vim\bundle\indentLine,C:\Users\pbugala\.vim\bundle\xml.vim,C:\Users\pbugala\.vim\bundle\matchit,C:\Users\pbugala\.vim\bundle\vim-ruby,C:\Users\pbugala\.vim\bundle\ruby-matchit,C:\Users\pbugala\.vim\bundle\vim-rspec,C:\Program Files (x86)\vim/vimfiles,C:\Program Files (x86)\vim\vim80,C:\Program Files (x86)\vim/vimfiles/after,C:\Users\pbugala/vimfiles/after,C:\Users\pbugala/.vim/bundle/vundle,C:\Users\pbugala\.vim\bundle\ide.vim/after,C:\Users\pbugala\.vim\bundle\Vundle.vim/after,C:\Users\pbugala\.vim\bundle\vim-puppet/after,C:\Users\pbugala\.vim\bundle\vim-fugitive/after,C:\Users\pbugala\.vim\bundle\vim-unimpaired/after,C:\Users\pbugala\.vim\bundle\vim-surround/after,C:\Users\pbugala\.vim\bundle\vim-easytags/after,C:\Users\pbugala\.vim\bundle\vim-misc/after,C:\Users\pbugala\.vim\bundle\vim-shell/after,C:\Users\pbugala\.vim\bundle\ale/after,C:\Users\pbugala\.vim\bundle\ctrlp.vim/after,C:\Users\pbugala\.vim\bundle\vim-tasks/after,C:\Users\pbugala\.vim\bundle\vim-gitgutter/after,C:\Users\pbugala\.vim\bundle\tabular/after,C:\Users\pbugala\.vim\bundle\vim-multiple-cursors/after,C:\Users\pbugala\.vim\bundle\vim-markdown/after,C:\Users\pbugala\.vim\bundle\indentLine/after,C:\Users\pbugala\.vim\bundle\xml.vim/after,C:\Users\pbugala\.vim\bundle\matchit/after,C:\Users\pbugala\.vim\bundle\vim-ruby/after,C:\Users\pbugala\.vim\bundle\ruby-matchit/after,C:\Users\pbugala\.vim\bundle\vim-rspec/after,C:\Users\pbugala\.vim\bundle\ale/after' | call xolox#misc#async#inside_child({'number': 1, 'function': 'xolox#easytags#update#with_vim', 'servername': 'GVIM1', 'callback': 'xolox#easytags#async_callback', 'arguments': [{'directory': 'C:\Users\pbugala\.vim\tags', 'filetypes': {'c#': 'cs', 'asp': 'aspvbs', 'c++': 'cpp'}, 'have_args': 0, 'default_filetype': 'puppet', 'ctags_version': 'Development', 'filter_tags': 1, 'command': 'c:\git-sdk-64\mingw64\bin\ctags.exe --fields=+l --c-kinds=+p --c++-kinds=+p --sort=no -f- ""--language-force=puppet"" ""c:\code\puppet\ilottery_profile\manifests\db2.pp""'}], 'starttime': ['xolox#misc#timer#value', [32, 502119976]]})"
shell.vim 0.13.6: Checking if compiled DDL is supported ..
shell.vim 0.13.6: Called function libversion() in DLL C:\Users\pbugala\.vim\bundle\vim-shell\misc\shell\shell-x64.dll, returning string '0.5' in 0.00056 seconds.
shell.vim 0.13.6: Yes the DDL works. Good for you! :-)
vim-misc 1.17.6: Executing external command using compiled DLL: "C:\Program Files (x86)\vim\vim80\vim.EXE" -u NONE -U NONE --noplugin -n -N -i NONE --cmd "let &rtp = 'C:\Users\pbugala/vimfiles,C:\Users\pbugala\.vim\bundle\ide.vim,C:\Users\pbugala\.vim\bundle\Vundle.vim,C:\Users\pbugala\.vim\bundle\vim-puppet,C:\Users\pbugala\.vim\bundle\vim-fugitive,C:\Users\pbugala\.vim\bundle\vim-unimpaired,C:\Users\pbugala\.vim\bundle\vim-surround,C:\Users\pbugala\.vim\bundle\vim-easytags,C:\Users\pbugala\.vim\bundle\vim-misc,C:\Users\pbugala\.vim\bundle\vim-shell,C:\Users\pbugala\.vim\bundle\ale,C:\Users\pbugala\.vim\bundle\ctrlp.vim,C:\Users\pbugala\.vim\bundle\vim-tasks,C:\Users\pbugala\.vim\bundle\vim-gitgutter,C:\Users\pbugala\.vim\bundle\tabular,C:\Users\pbugala\.vim\bundle\vim-multiple-cursors,C:\Users\pbugala\.vim\bundle\vim-markdown,C:\Users\pbugala\.vim\bundle\indentLine,C:\Users\pbugala\.vim\bundle\xml.vim,C:\Users\pbugala\.vim\bundle\matchit,C:\Users\pbugala\.vim\bundle\vim-ruby,C:\Users\pbugala\.vim\bundle\ruby-matchit,C:\Users\pbugala\.vim\bundle\vim-rspec,C:\Program Files (x86)\vim/vimfiles,C:\Program Files (x86)\vim\vim80,C:\Program Files (x86)\vim/vimfiles/after,C:\Users\pbugala/vimfiles/after,C:\Users\pbugala/.vim/bundle/vundle,C:\Users\pbugala\.vim\bundle\ide.vim/after,C:\Users\pbugala\.vim\bundle\Vundle.vim/after,C:\Users\pbugala\.vim\bundle\vim-puppet/after,C:\Users\pbugala\.vim\bundle\vim-fugitive/after,C:\Users\pbugala\.vim\bundle\vim-unimpaired/after,C:\Users\pbugala\.vim\bundle\vim-surround/after,C:\Users\pbugala\.vim\bundle\vim-easytags/after,C:\Users\pbugala\.vim\bundle\vim-misc/after,C:\Users\pbugala\.vim\bundle\vim-shell/after,C:\Users\pbugala\.vim\bundle\ale/after,C:\Users\pbugala\.vim\bundle\ctrlp.vim/after,C:\Users\pbugala\.vim\bundle\vim-tasks/after,C:\Users\pbugala\.vim\bundle\vim-gitgutter/after,C:\Users\pbugala\.vim\bundle\tabular/after,C:\Users\pbugala\.vim\bundle\vim-multiple-cursors/after,C:\Users\pbugala\.vim\bundle\vim-markdown/after,C:\Users\pbugala\.vim\bundle\indentLine/after,C:\Users\pbugala\.vim\bundle\xml.vim/after,C:\Users\pbugala\.vim\bundle\matchit/after,C:\Users\pbugala\.vim\bundle\vim-ruby/after,C:\Users\pbugala\.vim\bundle\ruby-matchit/after,C:\Users\pbugala\.vim\bundle\vim-rspec/after,C:\Users\pbugala\.vim\bundle\ale/after' | call xolox#misc#async#inside_child({'number': 1, 'function': 'xolox#easytags#update#with_vim', 'servername': 'GVIM1', 'callback': 'xolox#easytags#async_callback', 'arguments': [{'directory': 'C:\Users\pbugala\.vim\tags', 'filetypes': {'c#': 'cs', 'asp': 'aspvbs', 'c++': 'cpp'}, 'have_args': 0, 'default_filetype': 'puppet', 'ctags_version': 'Development', 'filter_tags': 1, 'command': 'c:\git-sdk-64\mingw64\bin\ctags.exe --fields=+l --c-kinds=+p --c++-kinds=+p --sort=no -f- ""--language-force=puppet"" ""c:\code\puppet\ilottery_profile\manifests\db2.pp""'}], 'starttime': ['xolox#misc#timer#value', [32, 502119976]]})"
shell.vim 0.13.6: Executing external command: cmd.exe /c ""C:\Program Files (x86)\vim\vim80\vim.EXE" -u NONE -U NONE --noplugin -n -N -i NONE --cmd "let &rtp = 'C:\Users\pbugala/vimfiles,C:\Users\pbugala\.vim\bundle\ide.vim,C:\Users\pbugala\.vim\bundle\Vundle.vim,C:\Users\pbugala\.vim\bundle\vim-puppet,C:\Users\pbugala\.vim\bundle\vim-fugitive,C:\Users\pbugala\.vim\bundle\vim-unimpaired,C:\Users\pbugala\.vim\bundle\vim-surround,C:\Users\pbugala\.vim\bundle\vim-easytags,C:\Users\pbugala\.vim\bundle\vim-misc,C:\Users\pbugala\.vim\bundle\vim-shell,C:\Users\pbugala\.vim\bundle\ale,C:\Users\pbugala\.vim\bundle\ctrlp.vim,C:\Users\pbugala\.vim\bundle\vim-tasks,C:\Users\pbugala\.vim\bundle\vim-gitgutter,C:\Users\pbugala\.vim\bundle\tabular,C:\Users\pbugala\.vim\bundle\vim-multiple-cursors,C:\Users\pbugala\.vim\bundle\vim-markdown,C:\Users\pbugala\.vim\bundle\indentLine,C:\Users\pbugala\.vim\bundle\xml.vim,C:\Users\pbugala\.vim\bundle\matchit,C:\Users\pbugala\.vim\bundle\vim-ruby,C:\Users\pbugala\.vim\bundle\ruby-matchit,C:\Users\pbugala\.vim\bundle\vim-rspec,C:\Program Files (x86)\vim/vimfiles,C:\Program Files (x86)\vim\vim80,C:\Program Files (x86)\vim/vimfiles/after,C:\Users\pbugala/vimfiles/after,C:\Users\pbugala/.vim/bundle/vundle,C:\Users\pbugala\.vim\bundle\ide.vim/after,C:\Users\pbugala\.vim\bundle\Vundle.vim/after,C:\Users\pbugala\.vim\bundle\vim-puppet/after,C:\Users\pbugala\.vim\bundle\vim-fugitive/after,C:\Users\pbugala\.vim\bundle\vim-unimpaired/after,C:\Users\pbugala\.vim\bundle\vim-surround/after,C:\Users\pbugala\.vim\bundle\vim-easytags/after,C:\Users\pbugala\.vim\bundle\vim-misc/after,C:\Users\pbugala\.vim\bundle\vim-shell/after,C:\Users\pbugala\.vim\bundle\ale/after,C:\Users\pbugala\.vim\bundle\ctrlp.vim/after,C:\Users\pbugala\.vim\bundle\vim-tasks/after,C:\Users\pbugala\.vim\bundle\vim-gitgutter/after,C:\Users\pbugala\.vim\bundle\tabular/after,C:\Users\pbugala\.vim\bundle\vim-multiple-cursors/after,C:\Users\pbugala\.vim\bundle\vim-markdown/after,C:\Users\pbugala\.vim\bundle\indentLine/after,C:\Users\pbugala\.vim\bundle\xml.vim/after,C:\Users\pbugala\.vim\bundle\matchit/after,C:\Users\pbugala\.vim\bundle\vim-ruby/after,C:\Users\pbugala\.vim\bundle\ruby-matchit/after,C:\Users\pbugala\.vim\bundle\vim-rspec/after,C:\Users\pbugala\.vim\bundle\ale/after' | call xolox#misc#async#inside_child({'number': 1, 'function': 'xolox#easytags#update#with_vim', 'servername': 'GVIM1', 'callback': 'xolox#easytags#async_callback', 'arguments': [{'directory': 'C:\Users\pbugala\.vim\tags', 'filetypes': {'c#': 'cs', 'asp': 'aspvbs', 'c++': 'cpp'}, 'have_args': 0, 'default_filetype': 'puppet', 'ctags_version': 'Development', 'filter_tags': 1, 'command': 'c:\git-sdk-64\mingw64\bin\ctags.exe --fields=+l --c-kinds=+p --c++-kinds=+p --sort=no -f- ""--language-force=puppet"" ""c:\code\puppet\ilottery_profile\manifests\db2.pp""'}], 'starttime': ['xolox#misc#timer#value', [32, 502119976]]})""
shell.vim 0.13.6: Called function execute_asynchronous() in DLL C:\Users\pbugala\.vim\bundle\vim-shell\misc\shell\shell-x64.dll, returning (empty string) in 0.0025 seconds.

The response (empty string) might be the clue but I'm not sure why its there since when I run that command from Windows CMD and I got proper response

C:\code\puppet\ilottery_profile>c:\git-sdk-64\mingw64\bin\ctags.exe --fields=+l --c-kinds=+p --c++-k
inds=+p --sort=no -f- ""--language-force=puppet"" ""c:\code\puppet\ilottery_profile\manifests\db2.pp
"
ilottery_profile::db2   c:\code\puppet\ilottery_profile\manifests\db2.pp        /^class ilottery_pro
file::db2 {$/;" c       language:puppet
::ilottery_profile::params      c:\code\puppet\ilottery_profile\manifests\db2.pp        /^  include
::ilottery_profile::params$/;"  i       language:puppet
$username       c:\code\puppet\ilottery_profile\manifests\db2.pp        /^  $username = $::ilottery_
profile::params::db_user$/;"    v       language:puppet
class['::ilottery_profile::package']    c:\code\puppet\ilottery_profile\manifests\db2.pp        /^
class {'::ilottery_profile::package':$/;"       r       language:puppet
db2::instance[$username ]       c:\code\puppet\ilottery_profile\manifests\db2.pp        /^  db2::ins
tance { $username :$/;" r       language:puppet
code    c:\code\puppet\ilottery_profile\manifests\db2.pp        /^    sitecode => $::customer,$/;"
s       language:puppet