658: Error : The patch to '<filepath>' didn't apply cleanly.
- NotABug
- Review Board
suda****@gmai***** (Google Code) (Is this you? Claim this profile.) | |
Sept. 21, 2009 |
What's the URL of the page containing the problem? http://reviewboard.eng.vmware.com/r/43966/diff/#index_header What steps will reproduce the problem? 1. I have a change that moves files from one directory to another (i.e. integrate/delete) 2. generated diffs using p5 diff -u -c ... 3. Upload the diffs and try to view the diffs. What is the expected output? What do you see instead? Normal diffs - what I see is http://reviewboard.eng.vmware.com/r/43966/diff/#index_header (paraphrased below) What operating system are you using? What browser? Windows XP / Firefox 3.0.1 Please provide any additional information below. The output is like the following: The patch to '<filepath>' didn't apply cleanly. The temporary files have been left in '/tmp/reviewboard.U-4jPA' for debugging purposes. `patch` returned: patching file /tmp/reviewboard.U-4jPA/tmpI632Lt patch: **** malformed patch at line 5: Traceback (most recent call last): File "/root/reviewboard/diffviewer/views.py", line 82, in view_diff files = get_diff_files(diffset, None, interdiffset, highlighting) File "/root/reviewboard/diffviewer/diffutils.py", line 577, in get_diff_files enable_syntax_highlighting) File "/root/reviewboard/diffviewer/diffutils.py", line 502, in generate_files lambda: get_chunks(filediff.diffset, File "/root/reviewboard/djblets/util/misc.py", line 47, in cache_memoize data = lookup_callable() File "/root/reviewboard/diffviewer/diffutils.py", line 505, in <lambda> enable_syntax_highlighting)) File "/root/reviewboard/diffviewer/diffutils.py", line 301, in get_chunks new = get_patched_file(old, filediff) File "/root/reviewboard/diffviewer/diffutils.py", line 214, in get_patched_file return patch(filediff.diff, buffer, filediff.dest_file) File "/root/reviewboard/diffviewer/diffutils.py", line 112, in patch (filename, tempdir, patch_output)) Exception: The patch to '<filepath>' didn't apply cleanly. The temporary files have been left in '/tmp/reviewboard.U-4jPA' for debugging purposes. `patch` returned: patching file /tmp/reviewboard.U-4jPA/tmpI632Lt patch: **** malformed patch at line 5:
We're having the exact same error for a diff of an xml file. Here is the diff that can reproduce the problem: --- //depot/project/module.xml //depot/project/module.xml#6 +++ //depot/project/module.xml 2008-12-04 12:00:46 @@ -1,17 +1,4 @@ <module> - <mainmenu label="Overview" id="overview" description="Access statistics, performance graphs, and links to helpful tools." icon="icon_mainmenu.png" smallicon="icon_mainmenu_small.pn g"> - </mainmenu> -</module>+ <mainmenu path="/system/mainmenu.jsp?menu=Overview"> + </mainmenu> +</module>
same issue here. I get the same error when posting reviews for newly created file (nothing to diff against)
We get exactly a similar error to the above while trying to view the diff in Review Board for some of the modified files (java code modification using Eclipse IDE)committed into SVN repository. We had tried to post the review via post-review tool as well as creating diff via svn diff command and uploading it via GUI; in both cases the error persists.
I too getting this error for few of the c files. Looks like patch is failing. The patch to 'src/amuoci.c' didn't apply cleanly. The temporary files have been left in 'c:\winnt\temp\reviewboard.qoyghn' for debugging purposes. `patch` returned: patching file c:\winnt\temp\reviewboard.qoyghn\tmpqbb31p Hunk #1 succeeded at 544 with fuzz 2. Hunk #2 FAILED at 592. Hunk #3 succeeded at 642 with fuzz 1. Hunk #4 FAILED at 656. 2 out of 6 hunks FAILED -- saving rejects to file c:\winnt\temp\reviewboard.qoyghn\tmpqbb31p-new.rej Traceback (most recent call last): File "c:\python25\lib\site-packages\ReviewBoard-1.0- py2.5.egg\reviewboard\diffviewer\views.py", line 152, in view_diff interdiffset, highlighting, True) File "c:\python25\lib\site-packages\ReviewBoard-1.0- py2.5.egg\reviewboard\diffviewer\diffutils.py", line 623, in get_diff_files large_data=True) File "c:\python25\lib\site-packages\Djblets-0.5-py2.5.egg\djblets\util\misc.py", line 143, in cache_memoize data = lookup_callable() File "c:\python25\lib\site-packages\ReviewBoard-1.0- py2.5.egg\reviewboard\diffviewer\diffutils.py", line 622, in <lambda> enable_syntax_highlighting), File "c:\python25\lib\site-packages\ReviewBoard-1.0- py2.5.egg\reviewboard\diffviewer\diffutils.py", line 345, in get_chunks new = get_patched_file(old, filediff) File "c:\python25\lib\site-packages\ReviewBoard-1.0- py2.5.egg\reviewboard\diffviewer\diffutils.py", line 261, in get_patched_file return patch(filediff.diff, buffer, filediff.dest_file) File "c:\python25\lib\site-packages\ReviewBoard-1.0- py2.5.egg\reviewboard\diffviewer\diffutils.py", line 129, in patch (filename, tempdir, patch_output)) Exception: The patch to 'src/amuoci.c' didn't apply cleanly. The temporary files have been left in 'c:\winnt\temp\reviewboard.qoyghn' for debugging purposes. `patch` returned: patching file c:\winnt\temp\reviewboard.qoyghn\tmpqbb31p Hunk #1 succeeded at 544 with fuzz 2. Hunk #2 FAILED at 592. Hunk #3 succeeded at 642 with fuzz 1. Hunk #4 FAILED at 656. 2 out of 6 hunks FAILED -- saving rejects to file c:\winnt\temp\reviewboard.qoyghn\tmpqbb31p-new.rej
This usually indicates that the revision is wrong. How was the diff generated, and what repository type?
diff is generated on UNIX and copied from screen to windows and that was the problem. Now he tried did an ftp and it worked. With the Review Baord 1.0 facing some problem for new request in two places. I am opening a new ticket shortly.
But how was the diff generated? What tool, parameters? Copying from screen to windows will break things. I assume you mean copy/paste. That won't necessarily get the right control characters (tabs, same type of newlines, etc). You will need to transfer the file directly. You also should look into using post-review, which will make life a lot easier.
diff was generated using cvs diff -u amuoci.c > amuoci.diff on UNIX. Here use made a mistake of copy/paste from UNIX shell to Windows. Now it worked after ftp. Sure, I will take a look into post-review and propose to our team hear. Thanks for the tip!
I tried with latest post-review version 0.8. The problem is we do have post- review.exe so we need to use UWIN / MKS / Cigwin to run this script on Windows. It would have been good if we have a post-review.exe stand alone application so user can use it here. I have no problem of using without exe but others are not comfortable.
Ah yeah, that's a potential problem for now. However, I do plan to get a post-review.exe into the next release.
That's great!
I also encountered this issue after a perforce to svn migration. Fixing the ident (RCS) strings solved the issue. The diff provided by svn had the perforce repo path in the ident string for the original copy. However the local copy used by review board had SVN Keywords substituted. As a result patch utility errored out
This is almost always caused by either (a) creating the diff incorrectly (for example, with the wrong line-endings), or (b) a character set mismatch. If there are specific bugs in the RB code, please file those separately.
-
+ NotABug
I get the same problem "Exception: The patch to 'file' didn't apply cleanly." This is a very intermittent issue. Earlier the diff was viewable but not anymore. Not sure what went wrong all of a sudden.
I would strongly vote and appreciate a solution/suggestions on this issue: Our environment is reviewboard 1.6.14 on Ubuntu 12.04 (64bits) w/ python 2.7, SCM is CVS We experienced quite a few this problems. As DARSHAN pointed out the problem is intermittent. For a single file in a diff package sometimes works, sometimes not. We tested on our old reviewboard (1.5.5), same error for the same diff package (and backend CVS repository) Diff currently unavailable. Error: The patch to 'project_sam.xml' didn't apply cleanly. The temporary files have been left in '/tmp/reviewboard.CRgaUy' for debugging purposes. `patch` returned: patching file /tmp/reviewboard.CRgaUy/tmpGdkjyO Hunk #1 FAILED at 1. 1 out of 1 hunk FAILED -- saving rejects to file /tmp/reviewboard.CRgaUy/tmpGdkjyO-new.rej Details Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.14-py2.7.egg/reviewboard/diffviewer/views.py", line 384, in view_diff_fragment file = get_requested_diff_file() File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.14-py2.7.egg/reviewboard/diffviewer/views.py", line 310, in get_requested_diff_file populate_diff_chunks(files, highlighting) File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.14-py2.7.egg/reviewboard/diffviewer/diffutils.py", line 1188, in populate_diff_chunks large_data=True) File "/usr/local/lib/python2.7/dist-packages/Djblets-0.6.27-py2.7.egg/djblets/util/misc.py", line 156, in cache_memoize data = lookup_callable() File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.14-py2.7.egg/reviewboard/diffviewer/diffutils.py", line 1187, in <lambda> enable_syntax_highlighting)), File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.14-py2.7.egg/reviewboard/diffviewer/diffutils.py", line 595, in get_chunks new = get_patched_file(old, filediff) File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.14-py2.7.egg/reviewboard/diffviewer/diffutils.py", line 388, in get_patched_file return patch(diff, buffer, filediff.dest_file) File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.14-py2.7.egg/reviewboard/diffviewer/diffutils.py", line 247, in patch (filename, tempdir, patch_output)) Exception: The patch to 'project_sam.xml' didn't apply cleanly. The temporary files have been left in '/tmp/reviewboard.CRgaUy' for debugging purposes. `patch` returned: patching file /tmp/reviewboard.CRgaUy/tmpGdkjyO Hunk #1 FAILED at 1. 1 out of 1 hunk FAILED -- saving rejects to file /tmp/reviewboard.CRgaUy/tmpGdkjyO-new.rej
Getting rejects usually indicates some problem with how the diff was generated. Check the .rej file to see what failed.
I attached the .rej file as below for information because I can not figure out the problem from the file. Thanks!
-
+
It's an existing file in CVS. We experienced that the same file change sometime works, sometimes not.
I have got this error too using a cvs generated diff (cvs diff -u foo.c) I found that it was barfing on changes to the $Id$ $Source$ lines in the file. When these were removed from the diff the error went away.