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

Move the shellescaping of the command to stage 2. #50

Closed inkarkat closed 11 years ago

inkarkat commented 11 years ago

On Windows, I get the following error

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

from the following command

"C:\Program Files\vim\vim73\gvim.exe" -u NONE -U NONE --noplugin -N --cmd "let &rtp = 'D:/A/.vim,C:\Program Files\vim/vimfiles,C:\Program Files\vim\vim73,C:\Program Files\vim/vimfiles/after,D:/A/.vim/after' | call xolox#easytags#update_remote({'cmdline': 'ctags --fields=+l --c-kinds=+p --c++-kinds=+p --sort=no -f- ""--language-force=vim"" ""D:\A\Unixhome\.vim\autoload\xolox\misc\path.vim""', 'by_filetype': '', 'tagsfile': '\A\Unixhome\.vim\tags', 'servername': 'GVIM', 'verbose': 1, 'have_args': 0, 'starttime': [400, 326843564], 'silent': 1, 'filter_tags': 0, 'cache': {}})"

The problem is in the doubled double quotes (""), resulting from xolox#misc#escape#shell() applied twice, one time for the shell execution in stage 2, and once for launching stage 2 from stage 1. Unfortunately, shell escaping is a hairy mess. Let's work around that by passing the individual command args as the original list to stage 2, and apply the shell escaping and joining there.

xolox commented 11 years ago

Thanks for the pull request and clear bug report. The change makes sense; it's now merged.