Re: Patch 7.3.443

2012-02-29 Fir de Conversatie Andy Wokula
Am 18.02.2012 18:14, schrieb Benjamin Fritz: On Wed, Feb 15, 2012 at 10:54 PM, Bram Moolenaar wrote: Please try the patch below. I currently do not have a Windows machine to try this out. I feel like an idiot, but I cannot get the patch to apply cleanly; and importing into mq just says the p

Re: Patch 7.3.443

2012-02-18 Fir de Conversatie Benjamin Fritz
On Wed, Feb 15, 2012 at 10:54 PM, Bram Moolenaar wrote: > Please try the patch below. I currently do not have a Windows machine > to try this out. I feel like an idiot, but I cannot get the patch to apply cleanly; and importing into mq just says the patch is empty! Can someone see what I'm doin

Re: Patch 7.3.443

2012-02-17 Fir de Conversatie Andy Wokula
Am 17.02.2012 13:43, schrieb Jürgen Krämer: works. Thanks :-) -- Andy -- 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

Re: Patch 7.3.443

2012-02-17 Fir de Conversatie Jürgen Krämer
Hi, Andy Wokula wrote: > Am 15.02.2012 19:36, schrieb Andy Wokula: >> Am 15.02.2012 17:22, schrieb Ben Fritz: New settings: shellcmdflag: /c shellxquote: ( and escape special chars with `^'. >>> >>> So you're saying, we must escape all special characters, INCLUDING >>> QUOTES,

Re: Patch 7.3.443

2012-02-17 Fir de Conversatie Ingo Karkat
On 17-Feb-2012 13:34, Andy Wokula wrote: > Am 15.02.2012 19:36, schrieb Andy Wokula: >> Am 15.02.2012 17:22, schrieb Ben Fritz: New settings: shellcmdflag: /c shellxquote: ( and escape special chars with `^'. >>> >>> So you're saying, we must escape all special characters, INCLU

Re: Patch 7.3.443

2012-02-17 Fir de Conversatie Andy Wokula
Am 15.02.2012 19:36, schrieb Andy Wokula: Am 15.02.2012 17:22, schrieb Ben Fritz: New settings: shellcmdflag: /c shellxquote: ( and escape special chars with `^'. So you're saying, we must escape all special characters, INCLUDING QUOTES, and surround in parentheses? Yes, including quotes!

Re: Patch 7.3.443

2012-02-17 Fir de Conversatie Edwin Steiner
P.S.: > # protect against expansion of %FOO% by turning it into %""FOO%: > > if (ch is '%' and the following character is not double_quote or > backslash) > quoted += double_quote + double_quote only insert the "" if there actually *is* a following character in cmd. R

Re: Patch 7.3.443

2012-02-17 Fir de Conversatie Edwin Steiner
Hi! As a further data point: I have found the following algorithm for Windows shell quoting quite reliable under the following conditions: * Windows 2000, Windows XP, or Windows 7 * the assembled command is executed using "system" * both parent and child programs compiled by MinGW I tested this

Re: Patch 7.3.443

2012-02-17 Fir de Conversatie George V. Reilly
On Thu, Feb 16, 2012 at 4:52 PM, John Beckett wrote: > Edwin Steiner wrote: > > I found it most reliable for testing to write a simple C > > program that prints its argv[] array. > > I did that a few years ago, and in case anyone is interested, > here is what I used. I fought with all this shellq

RE: Patch 7.3.443

2012-02-16 Fir de Conversatie John Beckett
Edwin Steiner wrote: > I found it most reliable for testing to write a simple C > program that prints its argv[] array. I did that a few years ago, and in case anyone is interested, here is what I used. /* Echo arguments in one line. * John Beckett 2007/05/25 * This is to see what is passed to

Re: Patch 7.3.443

2012-02-16 Fir de Conversatie Edwin Steiner
Hi! > Bram Moolenaar wrote: > > Andy Wokula wrote: > > > > > Am 14.02.2012 13:20, schrieb mattn: > > > > cmd /c "(echo a& echo b)" > > > > > > Ok! One caveat that I learned the hard way: Do not trust "echo" too much when testing shell quoting on Windows! On Windows the separation of the comm

Re: Patch 7.3.443

2012-02-16 Fir de Conversatie Andy Wokula
Am 16.02.2012 05:54, schrieb Bram Moolenaar: Please try the patch below. I currently do not have a Windows machine to try this out. I had success with applying the patch. :set shcf? sxq? shellcmdflag=/s /c shellxquote="( :!"my cat.exe" "file with spaces.txt" -> cmd.exe /s /c "("my cat.e

Re: Patch 7.3.443

2012-02-16 Fir de Conversatie Andy Wokula
Am 16.02.2012 22:05, schrieb Bram Moolenaar: Andy Wokula wrote: Am 16.02.2012 05:54, schrieb Bram Moolenaar: Ben Fritz wrote: I think we should do the auto-escaping, with shellxquote=(, and additionally add a help note by :! and system() that "According to the Microsoft documentation for cmd

Re: Patch 7.3.443

2012-02-16 Fir de Conversatie Bram Moolenaar
Andy Wokula wrote: > Am 16.02.2012 05:54, schrieb Bram Moolenaar: > > Ben Fritz wrote: > > > >> I think we should do the auto-escaping, with shellxquote=(, and > >> additionally add a help note by :! and system() that "According to > >> the Microsoft documentation for cmd.exe, you either need to

Re: Patch 7.3.443

2012-02-16 Fir de Conversatie Bram Moolenaar
I wrote: > Ben Fritz wrote: > > > I think we should do the auto-escaping, with shellxquote=(, and > > additionally add a help note by :! and system() that "According to the > > Microsoft documentation for cmd.exe, you either need to escape (with a > > ^ character) any of these characters appeari

Re: Patch 7.3.443

2012-02-16 Fir de Conversatie Andy Wokula
Am 16.02.2012 05:54, schrieb Bram Moolenaar: Ben Fritz wrote: I think we should do the auto-escaping, with shellxquote=(, and additionally add a help note by :! and system() that "According to the Microsoft documentation for cmd.exe, you either need to escape (with a ^ character) any of these c

Re: Patch 7.3.443

2012-02-15 Fir de Conversatie Bram Moolenaar
Ben Fritz wrote: > I think we should do the auto-escaping, with shellxquote=(, and > additionally add a help note by :! and system() that "According to the > Microsoft documentation for cmd.exe, you either need to escape (with a > ^ character) any of these characters appearing literally in your >

Re: Patch 7.3.443

2012-02-15 Fir de Conversatie Benjamin Fritz
On Wed, Feb 15, 2012 at 1:10 PM, Benjamin Fritz wrote: > Parentheses are still weird :-( > > C:\eclim-git\eclim>cmd /c echo abc) > abc) > I just realized this one is invalid anyway, since MS says you need to escape a literal ) and here the user does not > C:\eclim-git\eclim>cmd /c (echo abc)) >

Re: Patch 7.3.443

2012-02-15 Fir de Conversatie Benjamin Fritz
On Wed, Feb 15, 2012 at 12:36 PM, Andy Wokula wrote: > Am 15.02.2012 17:22, schrieb Ben Fritz: > >>> New settings: >>>      shellcmdflag: /c >>>      shellxquote: ( >>> and escape special chars with `^'. >> >> >> So you're saying, we must escape all special characters, INCLUDING >> QUOTES, and sur

Re: Patch 7.3.443

2012-02-15 Fir de Conversatie Benjamin Fritz
On Wed, Feb 15, 2012 at 12:36 PM, Andy Wokula wrote: >> So you're saying, we must escape all special characters, INCLUDING >> QUOTES, and surround in parentheses? > > > Yes, including quotes! > >> That's...special. > > > But solves all problems so far. Yes, but that doesn't mean I need to like it

Re: Patch 7.3.443

2012-02-15 Fir de Conversatie Andy Wokula
Am 15.02.2012 17:22, schrieb Ben Fritz: New settings: shellcmdflag: /c shellxquote: ( and escape special chars with `^'. So you're saying, we must escape all special characters, INCLUDING QUOTES, and surround in parentheses? Yes, including quotes! That's...special. But solves

Re: Patch 7.3.443

2012-02-15 Fir de Conversatie Ben Fritz
On Feb 15, 8:11 am, Andy Wokula wrote: > > Doesn't work either for `('...`)': >      cmd /c (cat cm.txt > "c&m.txt") > > it creates `c&m.txt)'. > > But `('...`)' works when inner special chars are escaped: >      cmd /c (cat cm.txt ^> ^"c^&m.txt^") >      cmd /c (echo a ^& echo b) >      cmd /c

Re: Patch 7.3.443

2012-02-15 Fir de Conversatie Andy Wokula
Am 15.02.2012 14:38, schrieb RoDo: You can execute cmd /c ("my editor.exe" "my filea.txt" a ^& dir) as well. Surprise -- it indeed executes `dir'. This suggests that special characters within `(' ... `)' should be escaped with `^'. The following works as well: cmd /c (^"my editor.exe^" ^

Re: Patch 7.3.443

2012-02-15 Fir de Conversatie RoDo
2 pm, mattn wrote: > > Patch: > > shellcmdflag: /c (not sure if `/s /c' would make a difference, > > I'd expect `/c' to always remove outer quotes) > > shellxquote: "( > > or maybe: > > shellxquote: "(,)" (new syntax!) > > >

Re: Patch 7.3.443

2012-02-15 Fir de Conversatie Andy Wokula
Am 15.02.2012 13:42, schrieb mattn: Patch: shellcmdflag: /c (not sure if `/s /c' would make a difference, I'd expect `/c' to always remove outer quotes) shellxquote: "( or maybe: shellxquote: "(,)" (new syntax!) Yeah, this works now (also did without patch 7.

Re: Patch 7.3.443

2012-02-15 Fir de Conversatie mattn
> Patch: > shellcmdflag: /c (not sure if `/s /c' would make a difference, > I'd expect `/c' to always remove outer quotes) > shellxquote: "( > or maybe: > shellxquote: "(,)" (new syntax!) > > Yeah, this works now (also did without patc

Re: Patch 7.3.443

2012-02-15 Fir de Conversatie Andy Wokula
ut: two lines, `a' and `b)' Problem: echo does not ignore the trailing `)' Solution: enclose cmd's argument in `"('...`)"' (I have no idea why this works) Patch: shellcmdflag: /c(not sure if `/s /c' would make a difference,

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie mattn
Please Please Please note that patch 7.3.443 is breaking original behavior. And just now many vim plugins does not work correctly without avoiding to this change. -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replyi

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie RoDo
Make every command work would be very complicated. Vim need to parse the command and understand it correctly, then escape the special chars. Let's give it back to user and cmd.exe. XD On Feb 15, 11:06 am, Bram Moolenaar wrote: > Ben Fritz wrote: > > On Feb 14, 4:31 am, RoDo wrote: > > > echo sy

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie mattn
> Ehm, thus 'shellxquote' should be "(, and we should turn that into )" > for the tail? It's possible, but I wonder where it breaks now. Yes, I wonder: * What is a problem * Why 7.3.443 is needed. -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie Bram Moolenaar
Ben Fritz wrote: > On Feb 14, 4:31 am, RoDo wrote: > > echo system('echo a & echo b') fail > > should escape & > > echo system('echo a ^& echo b') pass > > > > It looks like most of the use cases pass when using the () patch for > shellxquote, I like that option. > > Since there are still some

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie Bram Moolenaar
Rodo wrote: > Good. > > small patch: > > --- misc2_org.c 2012-02-14 18:09:38 +0800 > +++ misc2.c 2012-02-14 17:51:54 +0800 > @@ -3230,7 +3230,13 @@ > { > STRCPY(ncmd, p_sxq); > STRCAT(ncmd, cmd); > - STRCAT(ncmd, p_sxq); > +

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie Bram Moolenaar
Andy Wokula wrote: > Am 14.02.2012 13:20, schrieb mattn: > > cmd /c "(echo a& echo b)" > > Ok! Ehm, thus 'shellxquote' should be "(, and we should turn that into )" for the tail? It's possible, but I wonder where it breaks now. -- hundred-and-one symptoms of being an internet addict: 57. Yo

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie RoDo
Sorry, my mistake. Previous patch break shellxquote = \" update: --- os_win32_org.c 2012-02-14 21:18:54 +0800 +++ os_win32.c 2012-02-15 02:45:42 +0800 @@ -3909,6 +3909,7 @@ if (newcmd != NULL) { char_u *cmdbase = (*cmd == '"' ? cmd + 1 : cmd); + cmdbase

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie Ben Fritz
On Feb 13, 10:04 pm, Bram Moolenaar wrote: > Ben Fritz wrote: > > Ugh, apparently so. I thought the documentation of cmd.exe was clear > > enough to prevent this sort of thing, but that's apparently irrelevant > > because cmd.exe doesn't follow it. > > Never trust Microsoft documentation, always

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie Ben Fritz
On Feb 14, 4:31 am, RoDo wrote: > echo system('echo a & echo b') fail > should escape & > echo system('echo a ^& echo b') pass > It looks like most of the use cases pass when using the () patch for shellxquote, I like that option. Since there are still some failures when using an unescaped & m

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie RoDo
patch update add a os_win32 patch --- os_win32_org.c 2012-02-14 21:18:54 +0800 +++ os_win32.c 2012-02-14 21:24:27 +0800 @@ -3909,6 +3909,7 @@ if (newcmd != NULL) { char_u *cmdbase = (*cmd == '"' ? cmd + 1 : cmd); + cmdbase = (*cmd == '(' ? cmd + 1 : cmd)

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie Andy Wokula
Am 14.02.2012 13:20, schrieb mattn: cmd /c "(echo a& echo b)" Ok! -- Andy -- 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

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie mattn
cmd /c "(echo a & echo b)" -- 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

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie Mike Williams
On 14/02/2012 11:10, Andy Wokula wrote: Am 14.02.2012 11:31, schrieb RoDo: echo system('echo a & echo b') fail should escape & echo system('echo a ^& echo b') pass omg: C:\> echo a & echo b a b C:\> cmd /c ( echo a & echo b ) b ) Looks like a bug with cmd.exe . I guess it's specific to echo

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie Andy Wokula
Am 14.02.2012 11:31, schrieb RoDo: echo system('echo a & echo b') fail should escape & echo system('echo a ^& echo b') pass omg: C:\> echo a & echo b a b C:\> cmd /c ( echo a & echo b ) b ) Looks like a bug with cmd.exe . I guess it's specific to echo . And it's quite an esoteric command li

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie RoDo
echo system('echo a & echo b') fail should escape & echo system('echo a ^& echo b') pass On Feb 14, 6:21 pm, RoDo wrote: > Good. > > small patch: > > --- misc2_org.c 2012-02-14 18:09:38 +0800 > +++ misc2.c     2012-02-14 17:51:54 +0800 > @@ -3230,7 +3230,13 @@ >             { >                 ST

Re: Patch 7.3.443

2012-02-14 Fir de Conversatie RoDo
Good. small patch: --- misc2_org.c 2012-02-14 18:09:38 +0800 +++ misc2.c 2012-02-14 17:51:54 +0800 @@ -3230,7 +3230,13 @@ { STRCPY(ncmd, p_sxq); STRCAT(ncmd, cmd); - STRCAT(ncmd, p_sxq); +if (STRCMP(p_sxq, "(") == 0) +

Re: Patch 7.3.443

2012-02-13 Fir de Conversatie mattn
Or we can escape " to """. cmd.exe treat """ as quoted double quote. So #include int main(int argc, char* argv[]) { int n; for (n = 0; n < argc; n++) { printf("[%s]\n", argv[n]); } return 0; } C:\>arg [arg] C:\>arg foo [arg] [foo] C:\>arg "foo" [arg] [foo] C:\>arg ""foo

Re: Patch 7.3.443

2012-02-13 Fir de Conversatie Bram Moolenaar
Ben Fritz wrote: > On Feb 13, 12:14 pm, Andy Wokula wrote: > > Am 12.02.2012 23:23, schrieb Bram Moolenaar: > > > > > > > > > Patch 7.3.443 > > > Problem:    MS-Windows: 'shcf' and 'shellxquote' defaults are not very > &g

Re: Patch 7.3.443

2012-02-13 Fir de Conversatie Ben Fritz
On Feb 13, 12:14 pm, Andy Wokula wrote: > Am 12.02.2012 23:23, schrieb Bram Moolenaar: > > > > > Patch 7.3.443 > > Problem:    MS-Windows: 'shcf' and 'shellxquote' defaults are not very good. > > Solution:   Make a better guess when '

Re: [Bulk] Re: Patch 7.3.443

2012-02-13 Fir de Conversatie Andy Wokula
Am 13.02.2012 19:14, schrieb Andy Wokula: C:\>("C:\Program Files\abc.exe" "some arg with spaces") er, I meant C:\> cmd /c ("C:\Program Files\abc.exe" "some arg with spaces") -- Andy -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you a

Re: Patch 7.3.443

2012-02-13 Fir de Conversatie Andy Wokula
Am 12.02.2012 23:23, schrieb Bram Moolenaar: Patch 7.3.443 Problem:MS-Windows: 'shcf' and 'shellxquote' defaults are not very good. Solution: Make a better guess when 'shell' is set to "cmd.exe". (Ben Fritz) Files: src/option.c, runtime/doc/op

Re: Patch 7.3.443

2012-02-13 Fir de Conversatie RoDo
You are right. I total forget about this. I have a copy from vimrc_example which diffexpr set to MyDiff function. Remove it solve the problem. Thank you. It's time to clean my _vimrc. It's big and totally mess up. On Feb 14, 12:33 am, Ben Fritz wrote: > On Feb 13, 10:23 am, RoDo wrote: > > > Nev

Re: Patch 7.3.443

2012-02-13 Fir de Conversatie Ben Fritz
On Feb 13, 10:23 am, RoDo wrote: > Never know ^ before. > But pipe work without ^. > It's weird. > Also set shellxquote=\" breaks gvim -d. > The diff mode command should be changed too. > I've been using these values for shellxquote and shellcmdflag for a long time now, and use vimdiff all the

Re: Patch 7.3.443

2012-02-13 Fir de Conversatie RoDo
Never know ^ before. But pipe work without ^. It's weird. Also set shellxquote=\" breaks gvim -d. The diff mode command should be changed too. On Feb 14, 12:14 am, Ben Fritz wrote: > On Feb 13, 10:01 am, Ben Fritz wrote: > > > > > Maybe Vim can automatically add this ^ character somehow? This s

Re: Patch 7.3.443

2012-02-13 Fir de Conversatie Ben Fritz
On Feb 13, 10:01 am, Ben Fritz wrote: > > Maybe Vim can automatically add this ^ character somehow? This seems > like a job for shellescape(). > > As far as the patch is concerned, I still think it the right thing to > do. But we must ask, which is more likely to occur in a call to an > external

Re: Patch 7.3.443

2012-02-13 Fir de Conversatie Ben Fritz
On Feb 13, 9:41 am, Ben Fritz wrote: > > See cmd.exe /? > > If /C or /K is specified, then the remainder of the command line after > the switch is processed as a command line, where the following logic > is > used to process quote (") characters: > >     1.  If all of the following conditions ar

Re: Patch 7.3.443

2012-02-13 Fir de Conversatie Ben Fritz
On Feb 12, 8:34 pm, mattn wrote: > Easy way to reproduce. Check followings. > > :set shellxquote& > :echo system('dir "&"') > > :set shellxquote= > :echo system('dir "&"') > > This should be "File Nout Found". For me, without the patch, but setting the options as done in the patch, i.e.: gvim

Re: Patch 7.3.443

2012-02-13 Fir de Conversatie Ben Fritz
On Feb 12, 7:27 pm, mattn wrote: > Sorry for delay for my checking this patch. > > This break many behaviors to call external program on windows. > For example: > > Since 7.3.433: > > let command = 'openssl dgst -binary -sha1 -hmac "A&B" < c:/temp/foo.tmp' > let ret = system(command) > > This wa

Re: Patch 7.3.443

2012-02-13 Fir de Conversatie Andy Wokula
Am 13.02.2012 02:27, schrieb mattn: Sorry for delay for my checking this patch. This break many behaviors to call external program on windows. For example: Since 7.3.433: let command = 'openssl dgst -binary -sha1 -hmac "A&B"< c:/temp/foo.tmp' let ret = system(command) This was expanded to:

Re: Patch 7.3.443

2012-02-13 Fir de Conversatie RoDo
set noshelltemp get "File Not Found" So this patch solve the problem only if you use pipe. On 2月13日, 上午10时34分, mattn wrote: > Easy way to reproduce. Check followings. > > :set shellxquote& > :echo system('dir "&"') > > :set shellxquote= > :echo system('dir "&"') > > This should be "File Nout Fou

Re: Patch 7.3.443

2012-02-12 Fir de Conversatie mattn
> This is the opposite of what the patch was fixing. > What system is this on? Windows XP. using cmd.exe > What were the option values before and after the patch? I don't set anything. using defaults. > Does it work OK without the /s argument? No. -- You received this message from the "vi

Re: Patch 7.3.443

2012-02-12 Fir de Conversatie Bram Moolenaar
Yasuhiro Matsumoto wrote: > Sorry for delay for my checking this patch. > > This break many behaviors to call external program on windows. > For example: > > Since 7.3.433: > > let command = 'openssl dgst -binary -sha1 -hmac "A&B" < c:/temp/foo.tmp' > let ret = system(command) > > This was ex

Re: Patch 7.3.443

2012-02-12 Fir de Conversatie mattn
Easy way to reproduce. Check followings. :set shellxquote& :echo system('dir "&"') :set shellxquote= :echo system('dir "&"') This should be "File Nout Found". -- 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

Re: Patch 7.3.443

2012-02-12 Fir de Conversatie mattn
Sorry for delay for my checking this patch. This break many behaviors to call external program on windows. For example: Since 7.3.433: let command = 'openssl dgst -binary -sha1 -hmac "A&B" < c:/temp/foo.tmp' let ret = system(command) This was expanded to: cmd /c openssl dgst -binary -sha1 -hma

Patch 7.3.443

2012-02-12 Fir de Conversatie Bram Moolenaar
Patch 7.3.443 Problem:MS-Windows: 'shcf' and 'shellxquote' defaults are not very good. Solution: Make a better guess when 'shell' is set to "cmd.exe". (Ben Fritz) Files: src/option.c, runtime/doc/options.txt *** ../vim-7.3.442/src/option.c 201