When using TCC (v23.00.25 x64 on Win7 SP1) I find that the Subversion (svn) diff command doesn't get parsed the same way as cmd.exe does it.
In order for svn to integrate with a GUI diff utility, you write a script that parses a bunch of command line options then have the script turn around and pass the options in the order and with the switches appropriate for the GUI diff program (Beyond Compare in my case).
I found that the script that was working in cmd.exe broke when I tried it in TCC. Here's a version of the script that simply dumps the arguments passed to it:
- is this a TCC bug?
- if not, is there a way I can have one batch file that parses the command line the same way in both cmd.exe and in TCC?
- why doesn't TCC expand the %* construct when it is immediately followed by a ':'? It only does this when it is immediately followed by a colon - and I often use a colon as a delimiter when debugging command line arguments because I find that using quotes makes it difficult to spot how quotes are actually being used.
Update (again): I added a "pause" command to the end of the script so I could see exactly how svn.exe is invoking the batch file with the "Process Explorer" tool. It turns out that svn is wrapping the whole command line in double-quotes (and escaping parens and backslashes).
I think that wrapping an entire command in double-quotes even when arguments are double-quoted is not an uncommon behavior, taking advantage of on of the hundreds of quirks/bugs in cmd.exe (but I don't really know that for sure - I don't know how rconn stays sane trying to keep TCC backwards compatible with cmd.exe).
Is there some reasonable way I can get TCC to handle this in a cmd.exe compatible way?
I have posted the simple batch file that parses the command line. I have also posted information about how Subversion invokes the script which seems to be the root of the problem: the whole command line is enclosed in double-quotes while it contains items that are also quoted using double quotes.
That's not a good idea. Without :: TCC's %* works better. Besides that, I see that TCC and CMD work the same if there are or are not an outer set of quotes. (What appears next is a code block.)
The problem seems to boil down to the '^' quoting escaping of the double-quotes around arguments. The following examples use Vincent's "allargs.bat" script:
Note that if instead of passing %ALLARGS% to :doit I pass %*, TCC still parses the arguments to :doit in a way that splits the "1 and the 2" tokens. I don't know why that would be, but I'm not sure I care all that much.
To be clear, I think that TCC is behaving entirely reasonably - escaping the quotes should be an indication that the quotes be treated as normal characters not as quotes (that's what bash would do). However, cmd.exe doesn't do that and Subversion seems to rely on that cmd.exe bug. And that puts TCC in a bad position.
Anyway, I'm perfectly happy with the workaround. So rconn can do whatever he likes with this information (including ignoring it).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.