ramccor / vcscommand

Automatically exported from code.google.com/p/vcscommand
0 stars 0 forks source link

Vim commands `:VCSLog` etc produce malformed command lines on Windows #113

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Install the Vim plugin on Windows (any version).
2. In a working dir (of `cvs` for example), type ":VCSLog" in Vim.
3. An Error message appears, quoting the (correct) `cvs` command line, but 
saying that it couldn't be found.

What is the expected output? What do you see instead?

The expected output is the output of the executed VCS command (in this case, of 
the `cvs` command).

What version of the product are you using? On what operating system?

VCSCommand: vcscommand-1.99.47.zip.

OS: Windows 7 (64 bit) and Windows XP (32 bit) - doesn't matter.

Please provide any additional information below.

ANALYSIS AND PROPOSED FIX
-------------------------

1. To execute VCS commands, `vcscommand` uses the Vim function "system" (called 
by the function "VCSCommandUtility.system()" in `vcscommand.vim`), which in 
turn passes the command line string to the Standard C library function 
`system()`. On Windows, this command line string is then interpreted by 
`cmd.exe`.

2. The current `vcscommand.vim` passes a command line to `cmd.exe` which is 
treated as a *single* command: the string gets *not* split into words as it 
should. (This is caused by the - indeed required - quote characters around the 
VCS command and the directory argument.) Since the command line as a whole is 
not an executable pathname, the cited error message appears.

3. I modified the `vcscommand.vim` file in a way that fixes the problem for me: 
introduce *another* pair of quotes. The `:VCSLog` etc commands then work as 
expected (see the attached diff file):

381c381,384
<       let output = call('system', a:000)

---
> " mrtnhfmnn@gmail.com 2014-03-19: Hassle with quotes in command line on Win.
> "     let output = call('system', a:000)
>       let cmdline = "\"" . a:1 . "\""
>       let output = system(cmdline)

Original issue reported on code.google.com by mrtnhf...@gmail.com on 19 Mar 2014 at 7:18

Attachments:

GoogleCodeExporter commented 9 years ago
Which VIM version are you using?  This issue is usually caused by using an old 
version of VIM, or by (incorrectly) messing with the shell quoting settings.

Original comment by bob.hies...@gmail.com on 19 Mar 2014 at 4:09

GoogleCodeExporter commented 9 years ago
@bob.hiestand: I had the same issue with Vim 7.2 on Windows XP SP3 (x86) and 
with Vim 7.3 on Windows 7 (x86_64). I'm not aware of any messing around with 
shell quoting settings on either machine. If however you can't reproduce this 
behaviour, I'll leave it at this and will blame my unfortunate systems ;-) - I 
just wanted to share what I've done to get the Plugin working (on Windows, that 
is: I have yet to try it out on an *IXish system, and would expect my change to 
cause problems there ...).

Original comment by mrtnhf...@gmail.com on 21 Mar 2014 at 8:06

GoogleCodeExporter commented 9 years ago
Meanwhile, I updated Vim to (the current) version 7.4 (of 2013-08-10) - and the 
problem disappeared! 

So, good-bye and thank you for your time and effort to produce this nice plugin 
:-)

Original comment by mrtnhf...@gmail.com on 23 Mar 2014 at 8:31