[PATCH STABLE] extdiff: quote only options specified at runtime (issue4463)

Yuya Nishihara yuya at tcha.org
Tue Dec 2 09:05:04 CST 2014


On Mon, 01 Dec 2014 18:13:15 -0600, Matt Mackall wrote:
> On Tue, 2014-12-02 at 02:44 +0900, FUJIWARA Katsunori wrote:
> > # HG changeset patch
> > # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> > # Date 1417454278 -32400
> > #      Tue Dec 02 02:17:58 2014 +0900
> > # Branch stable
> > # Node ID d887d27304009d1cac05a1db4399f69d1778c5f0
> > # Parent  edf29f9c15f0f171847f4c7a8184cca4e95c8b31
> > extdiff: quote only options specified at runtime (issue4463)
> > 
> > For arguments and options including white spaces, changeset
> > 72a89cf86fcd introduced fully quoting on all command line arguments
> > and options for external diff command.
> > 
> > But this causes unexpected behavior of extdiff with WinMerge, because
> > WinMerge can't work correctly, when command line options in Windows
> > standard style are quoted: for example, 'WinMerge /r ....' is OK, but
> > 'WinMerge "/r" ....' is NG).
> 
> Presumably this is no good because WinMerge doesn't use the standard
> argument parser in Microsoft's C runtime (the thing that gives argc and
> argv to main()) and instead uses the raw single-string lpCmdLine passed
> to WinMain... and then does its own broken parsing that doesn't handle
> quoting on things that aren't filenames. Sigh.

How about making windows.shellquote() not quote known-safe argument?
As many GUI applications start from WinMain() (or MFC's equivalent), I think,
they can easily invent broken command-line parsers.

subprocess.list2cmdline() might have some hints, which says "using the same
rules as the MS C runtime."

Regards,


More information about the Mercurial-devel mailing list