[Bug 3723] New: diff headers incorrect for carefully chosen filenames

bugzilla-daemon at bz.selenic.com bugzilla-daemon at bz.selenic.com
Wed Dec 5 16:29:05 UTC 2012


http://bz.selenic.com/show_bug.cgi?id=3723

          Priority: normal
            Bug ID: 3723
                CC: mercurial-devel at selenic.com
          Assignee: bugzilla at selenic.com
           Summary: diff headers incorrect for carefully chosen filenames
          Severity: bug
    Classification: Unclassified
                OS: All
          Reporter: alastair at alastairs-place.net
          Hardware: All
            Status: UNCONFIRMED
           Version: 2.4
         Component: Mercurial
           Product: Mercurial

In Mercurial's diff output, the diff lines output filenames without any quoting
or shell escaping.  This creates problems for various carefully chosen
filenames; for instance if I do

  hg init foo
  cd foo
  mkdir "foo b"
  echo Hello > "foo b/foo.txt"
  hg addremove
  hg commit -m "Commit changes"
  hg export -g -r 0

I get

----
# HG changeset patch
# User Alastair Houghton <email at example.com>
# Date 1354723695 0
# Node ID 05d4379957885c17540aaf31d2f26e77567334e8
# Parent  0000000000000000000000000000000000000000
Commit changes

diff --git a/foo b/foo.txt b/foo b/foo.txt
new file mode 100644
--- /dev/null
+++ b/foo b/foo.txt    
@@ -0,0 +1,1 @@
+Hello
----

If I save that in a file "foo.patch" then try

  hg init frob
  cd frob
  hg import /path/to/foo.patch

I get

----
applying /path/to/foo.patch
abort: failed to synchronize metadata for "foo b/foo.txt b/foo"
----

which rather illustrates the problem, namely that Mercurial is generating a
diff line that cannot possibly be parsed, then attempting to parse it using a
regexp, which is obviously going to fail because the " b/(.*)" in the regexp
will match everything after "a/foo".

-- 
You are receiving this mail because:
You are on the CC list for the bug.



More information about the Mercurial-devel mailing list