Patchwork [STABLE] windows: make shellquote() quote any path containing '\' (issue4629)

login
register
mail settings
Submitter Matt Harbison
Date April 30, 2015, 4:34 a.m.
Message ID <2080952cde78a5926832.1430368457@Envy>
Download mbox | patch
Permalink /patch/8819/
State Accepted
Headers show

Comments

Matt Harbison - April 30, 2015, 4:34 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1430356499 14400
#      Wed Apr 29 21:14:59 2015 -0400
# Branch stable
# Node ID 2080952cde78a59268326126026a35076f7afbe7
# Parent  995003a324da67242e5c4e9afa18fe9d335f9985
windows: make shellquote() quote any path containing '\' (issue4629)

The '~' in the bug report is being expanded to a path with Windows style slashes
before being passed to shellquote() via util.shellquote().  But shlex.split()
strips '\' out of the string, leaving an invalid path in dispatch.aliasargs().

This regressed in 1642eb429536.

For now, the tests need to be conditionalized for Windows (because those paths
are quoted).  In the future, a more complex regex could probably skip the quotes
if all component separators are double '\'.  I opted to glob away the quotes in
test-rename-merge2.t and test-up-local-change.t (which only exist on Windows),
because they are in very large blocks of output and there are way too many diffs
to conditionalize with #if directives.  Maybe the entire path should be globbed
away like the following paths in each changed line.  Or, letting #if directives
sit in the middle of the output as was mentioned a few months back would work
too.

Unfortunately, I couldn't figure out how to test the specific bug.  All of the
'hg serve' tests have a #require serve declaration, causing them to be skipped
on Windows.  Adding an alias for 'expandtest = outgoing ~/bogusrepo' prints the
repo as '$TESTTMP/bogusrepo', so the test runner must be changing the
environment somehow.
Matt Mackall - April 30, 2015, 8:22 p.m.
On Thu, 2015-04-30 at 00:34 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1430356499 14400
> #      Wed Apr 29 21:14:59 2015 -0400
> # Branch stable
> # Node ID 2080952cde78a59268326126026a35076f7afbe7
> # Parent  995003a324da67242e5c4e9afa18fe9d335f9985
> windows: make shellquote() quote any path containing '\' (issue4629)

Queued for stable, thanks.

Moving forward, the right way to test this sort of pure functional
string manipulation is a doctest. It's much faster and easier to be
comprehensive.

Patch

diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -167,10 +167,12 @@ 
         _quotere = re.compile(r'(\\*)("|\\$)')
     global _needsshellquote
     if _needsshellquote is None:
-        # ":" and "\\" are also treated as "safe character", because
-        # they are used as a part of path name (and the latter doesn't
-        # work as "escape character", like one on posix) on Windows
-        _needsshellquote = re.compile(r'[^a-zA-Z0-9._:/\\-]').search
+        # ":" is also treated as "safe character", because it is used as a part
+        # of path name on Windows.  "\" is also part of a path name, but isn't
+        # safe because shlex.split() (kind of) treats it as an escape char and
+        # drops it.  It will leave the next character, even if it is another
+        # "\".
+        _needsshellquote = re.compile(r'[^a-zA-Z0-9._:/-]').search
     if s and not _needsshellquote(s) and not _quotere.search(s):
         # "s" shouldn't have to be quoted
         return s
diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t
--- a/tests/test-extdiff.t
+++ b/tests/test-extdiff.t
@@ -58,9 +58,15 @@ 
 
 Should diff cloned files directly:
 
+#if windows
+  $ hg falabala -r 0:1
+  diffing "*\\extdiff.*\\a.8a5febb7f867\\a" "a.34eed99112ab\\a" (glob)
+  [1]
+#else
   $ hg falabala -r 0:1
   diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
   [1]
+#endif
 
 Test diff during merge:
 
@@ -76,23 +82,41 @@ 
 
 Should diff cloned file against wc file:
 
+#if windows
+  $ hg falabala
+  diffing "*\\extdiff.*\\a.2a13a4d2da36\\a" "*\\a\\a" (glob)
+  [1]
+#else
   $ hg falabala
   diffing */extdiff.*/a.2a13a4d2da36/a */a/a (glob)
   [1]
+#endif
 
 
 Test --change option:
 
   $ hg ci -d '2 0' -mtest3
+#if windows
+  $ hg falabala -c 1
+  diffing "*\\extdiff.*\\a.8a5febb7f867\\a" "a.34eed99112ab\\a" (glob)
+  [1]
+#else
   $ hg falabala -c 1
   diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
   [1]
+#endif
 
 Check diff are made from the first parent:
 
+#if windows
+  $ hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code"
+  diffing "*\\extdiff.*\\a.2a13a4d2da36\\a" "a.46c0e4daeb72\\a" (glob)
+  diff-like tools yield a non-zero exit code
+#else
   $ hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code"
   diffing */extdiff.*/a.2a13a4d2da36/a a.46c0e4daeb72/a (glob)
   diff-like tools yield a non-zero exit code
+#endif
 
 issue4463: usage of command line configuration without additional quoting
 
@@ -107,11 +131,11 @@ 
   $ echo a >> a
 #if windows
   $ hg --debug 4463a | grep '^running'
-  running 'echo a-naked \'single quoted\' "double quoted" *\\a *\\a' in */extdiff.* (glob)
+  running 'echo a-naked \'single quoted\' "double quoted" "*\\a" "*\\a"' in */extdiff.* (glob)
   $ hg --debug 4463b | grep '^running'
-  running 'echo b-naked \'single quoted\' "double quoted" *\\a *\\a' in */extdiff.* (glob)
+  running 'echo b-naked \'single quoted\' "double quoted" "*\\a" "*\\a"' in */extdiff.* (glob)
   $ hg --debug echo | grep '^running'
-  running '*echo* *\\a *\\a' in */extdiff.* (glob)
+  running '*echo* "*\\a" "*\\a"' in */extdiff.* (glob)
 #else
   $ hg --debug 4463a | grep '^running'
   running 'echo a-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob)
@@ -138,15 +162,15 @@ 
   > EOF
 #if windows
   $ hg --debug 4463b2 | grep '^running'
-  running 'echo b2-naked \'single quoted\' "double quoted" *\\a *\\a' in */extdiff.* (glob)
+  running 'echo b2-naked \'single quoted\' "double quoted" "*\\a" "*\\a"' in */extdiff.* (glob)
   $ hg --debug 4463b3 | grep '^running'
-  running 'echo b3-naked \'single quoted\' "double quoted" *\\a *\\a' in */extdiff.* (glob)
+  running 'echo b3-naked \'single quoted\' "double quoted" "*\\a" "*\\a"' in */extdiff.* (glob)
   $ hg --debug 4463b4 | grep '^running'
-  running 'echo *\\a *\\a' in */extdiff.* (glob)
+  running 'echo "*\\a" "*\\a"' in */extdiff.* (glob)
   $ hg --debug 4463b4 --option b4-naked --option 'being quoted' | grep '^running'
-  running 'echo b4-naked "being quoted" *\\a *\\a' in */extdiff.* (glob)
+  running 'echo b4-naked "being quoted" "*\\a" "*\\a"' in */extdiff.* (glob)
   $ hg --debug extdiff -p echo --option echo-naked --option 'being quoted' | grep '^running'
-  running 'echo echo-naked "being quoted" *\\a *\\a' in */extdiff.* (glob)
+  running 'echo echo-naked "being quoted" "*\\a" "*\\a"' in */extdiff.* (glob)
 #else
   $ hg --debug 4463b2 | grep '^running'
   running 'echo b2-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob)
diff --git a/tests/test-rename-merge2.t b/tests/test-rename-merge2.t
--- a/tests/test-rename-merge2.t
+++ b/tests/test-rename-merge2.t
@@ -100,7 +100,7 @@ 
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@e300d1c794ec+ other rev@4ce40f5aca24 ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   0 files updated, 2 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -140,7 +140,7 @@ 
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@86a2aa42fc76+ other rev@f4db7e329e71 ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * (glob)
   merge tool returned: 0
   1 files updated, 2 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -178,7 +178,7 @@ 
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@e300d1c794ec+ other rev@bdb19105162a ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   0 files updated, 2 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -214,7 +214,7 @@ 
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@02963e448370+ other rev@f4db7e329e71 ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   0 files updated, 2 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -246,7 +246,7 @@ 
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@94b33a1b7f2d+ other rev@4ce40f5aca24 ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   1 files updated, 1 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -275,7 +275,7 @@ 
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@86a2aa42fc76+ other rev@97c705ade336 ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -310,7 +310,7 @@ 
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@94b33a1b7f2d+ other rev@bdb19105162a ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   1 files updated, 1 files merged, 1 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -338,7 +338,7 @@ 
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@02963e448370+ other rev@97c705ade336 ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -364,14 +364,14 @@ 
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@62e7bf090eba+ other b@49b6d8032493 ancestor a@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/b * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
    rev: versions differ -> m
   updating: rev 2/2 files (100.00%)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   0 files updated, 2 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -408,7 +408,7 @@ 
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@02963e448370+ other rev@fe905ef2c33e ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   note: possible conflict - a was renamed multiple times to:
    b
@@ -438,14 +438,14 @@ 
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@86a2aa42fc76+ other b@af30c7647fc7 ancestor b@000000000000
-  launching merge tool: python ../merge $TESTTMP/t/t/b * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
    rev: versions differ -> m
   updating: rev 2/2 files (100.00%)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   0 files updated, 2 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -475,14 +475,14 @@ 
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
-  launching merge tool: python ../merge $TESTTMP/t/t/b * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
    rev: versions differ -> m
   updating: rev 3/3 files (100.00%)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   0 files updated, 2 files merged, 1 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -511,14 +511,14 @@ 
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
-  launching merge tool: python ../merge $TESTTMP/t/t/b * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
    rev: versions differ -> m
   updating: rev 3/3 files (100.00%)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   1 files updated, 2 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -548,14 +548,14 @@ 
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
-  launching merge tool: python ../merge $TESTTMP/t/t/b * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
    rev: versions differ -> m
   updating: rev 3/3 files (100.00%)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   0 files updated, 2 files merged, 1 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -584,14 +584,14 @@ 
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
-  launching merge tool: python ../merge $TESTTMP/t/t/b * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
    rev: versions differ -> m
   updating: rev 3/3 files (100.00%)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   1 files updated, 2 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -619,14 +619,14 @@ 
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000
-  launching merge tool: python ../merge $TESTTMP/t/t/b * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
    rev: versions differ -> m
   updating: rev 2/2 files (100.00%)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   0 files updated, 2 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -658,14 +658,14 @@ 
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000
-  launching merge tool: python ../merge $TESTTMP/t/t/b * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
    rev: versions differ -> m
   updating: rev 3/3 files (100.00%)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   1 files updated, 2 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -696,14 +696,14 @@ 
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000
-  launching merge tool: python ../merge $TESTTMP/t/t/b * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
    rev: versions differ -> m
   updating: rev 3/3 files (100.00%)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   0 files updated, 2 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -734,14 +734,14 @@ 
   picked tool 'python ../merge' for b (binary False symlink False)
   merging a and b to b
   my b@e300d1c794ec+ other b@49b6d8032493 ancestor a@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/b * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
    rev: versions differ -> m
   updating: rev 2/2 files (100.00%)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   0 files updated, 2 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -771,14 +771,14 @@ 
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b and a to b
   my b@62e7bf090eba+ other a@f4db7e329e71 ancestor a@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/b * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
    rev: versions differ -> m
   updating: rev 2/2 files (100.00%)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   0 files updated, 2 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -822,7 +822,7 @@ 
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@02963e448370+ other rev@2b958612230f ancestor rev@924404dff337
-  launching merge tool: python ../merge $TESTTMP/t/t/rev * * (glob)
+  launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
   merge tool returned: 0
   1 files updated, 2 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
diff --git a/tests/test-up-local-change.t b/tests/test-up-local-change.t
--- a/tests/test-up-local-change.t
+++ b/tests/test-up-local-change.t
@@ -55,7 +55,7 @@ 
   picked tool 'true' for a (binary False symlink False)
   merging a
   my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
-  launching merge tool: true $TESTTMP/r2/a * (glob)
+  launching merge tool: true *$TESTTMP/r2/a* * (glob)
   merge tool returned: 0
   1 files updated, 1 files merged, 0 files removed, 0 files unresolved
   $ hg parents
@@ -78,7 +78,7 @@ 
   picked tool 'true' for a (binary False symlink False)
   merging a
   my a@1e71731e6fbb+ other a@c19d34741b0a ancestor a@1e71731e6fbb
-  launching merge tool: true $TESTTMP/r2/a * (glob)
+  launching merge tool: true *$TESTTMP/r2/a* * (glob)
   merge tool returned: 0
   0 files updated, 1 files merged, 1 files removed, 0 files unresolved
   $ hg parents
@@ -109,7 +109,7 @@ 
   picked tool 'true' for a (binary False symlink False)
   merging a
   my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
-  launching merge tool: true $TESTTMP/r2/a * (glob)
+  launching merge tool: true *$TESTTMP/r2/a* * (glob)
   merge tool returned: 0
   1 files updated, 1 files merged, 0 files removed, 0 files unresolved
   $ hg parents