68422Re: Encountered problem with changed Windows 'shcf' and 'sxq' defaults.
- Feb 22, 2013On Friday, February 22, 2013 3:27:41 AM UTC-6, Ingo Karkat wrote:
> Hello Vim developers,In other words, if you encounter errors passing arguments to the shell, try
> Sorry for touching that can of worms again, but I've come upon a problem with
> the changed 'shellxquote' option on Windows (patch 7.3.443 (MS-Windows: 'shcf'
> and 'sxq' defaults are not very good) and the few patches following it. Here's
> the discussion as a refresher:
> The problem:
> vim -N -u NONE
> :echo system('echo.hi(ho)hi')
> E484: Can't open file D:\temp\VIo408F.tmp
> It's the unquoted parentheses in the command. My actual command was
> :echo system('icacls ' . shellescape('C:\foo') . ' /deny
> REM Best recommendation is probably to always quote all arguments, even when not
> necessary in a plain shell.
> C:\> C:\Windows\system32\cmd.exe /c (echo.^"hi^(ho^)hi^" ^>D:\temp\VIo8945.tmp
> Therefore, every argument should be quoted; this works:
> :echo system('icacls ' . shellescape('C:\foo') . ' /deny ' .
using shellescape, or try escaping things manually with ^. Your original example
Either of these variants work:
Alternatively, :help 'shellxquote' says that if it is "( then )" is appended.
This gave me a hint, which I tested; this also works:
What are you asking for exactly? A note in the help? Or some further update to
the quoting of shell arguments on Windows? I think a note in the help should
suffice. Where do you think it should go? Maybe we can add a note to E484 that
on Windows it is sometimes caused by unescaped special characters, and to try
using shellescape or a new value of shellxquote to fix it.
Can of worms, indeed! I didn't realize how bad cmd.exe is until that series of patches.
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
For more options, visit https://groups.google.com/groups/opt_out.
- << Previous post in topic Next post in topic >>