583: ReviewBoard does not verify patch when uploading
- Fixed
- Review Board
gow****@gmai***** (Google Code) (Is this you? Claim this profile.) | |
Sept. 26, 2013 | |
522, 1197, 1217 |
What's the URL of the page containing the problem? n/a What steps will reproduce the problem? 1. Create a new review but use the wrong base path for the diff 2. Submit patch 3. Attempt to view diff What is the expected output? What do you see instead? In previous version of review board, when creating a new review the diff was verified, so that it caught and reported errors in the base path. It basically said that the file(s) did not exist in the repository. Now it accepts the diff, and instead reports an error only when someone tries to view the diff. Worse, it just displays a raw traceback, rather than a nicely formatted error for the end user. The previous behavior of blocking the creation of the review is much more desirable. What operating system are you using? What browser? Linux/Firefox 3.0.1 Please provide any additional information below. Traceback from viewing the diff with the wrong base path: The file 'branches/branch_trunk/phonex_supp/phonex/util/http/HttpConnection.cpp' (r61905) could not be found in the repository: PROPFIND request failed on '/svn/!svn/bc/61905/ipphone/branches/branch_trunk/phonex_supp/phonex/util/http/HttpConnection.cpp' '/svn/!svn/bc/61905/ipphone/branches/branch_trunk/phonex_supp/phonex/util/http/HttpConnection.cpp' path not found Traceback (most recent call last): File "/usr/local/lib/python2.5/site-packages/reviewboard/diffviewer/views.py", line 82, in view_diff files = get_diff_files(diffset, None, interdiffset, highlighting) File "/usr/local/lib/python2.5/site-packages/reviewboard/diffviewer/diffutils.py", line 599, in get_diff_files enable_syntax_highlighting) File "/usr/local/lib/python2.5/site-packages/reviewboard/diffviewer/diffutils.py", line 518, in generate_files lambda: get_chunks(filediff.diffset, File "/usr/local/lib/python2.5/site-packages/djblets/util/misc.py", line 49, in cache_memoize data = lookup_callable() File "/usr/local/lib/python2.5/site-packages/reviewboard/diffviewer/diffutils.py", line 521, in <lambda> enable_syntax_highlighting)) File "/usr/local/lib/python2.5/site-packages/reviewboard/diffviewer/diffutils.py", line 321, in get_chunks old = get_original_file(filediff) File "/usr/local/lib/python2.5/site-packages/reviewboard/diffviewer/diffutils.py", line 228, in get_original_file data = cache_memoize(key, lambda: [tool.get_file(file, revision)])[0] File "/usr/local/lib/python2.5/site-packages/djblets/util/misc.py", line 49, in cache_memoize data = lookup_callable() File "/usr/local/lib/python2.5/site-packages/reviewboard/diffviewer/diffutils.py", line 228, in <lambda> data = cache_memoize(key, lambda: [tool.get_file(file, revision)])[0] File "/usr/local/lib/python2.5/site-packages/reviewboard/scmtools/svn.py", line 107, in get_file raise FileNotFoundError(path, revision, str(e)) FileNotFoundError: The file 'branches/branch_trunk/phonex_supp/phonex/util/http/HttpConnection.cpp' (r61905) could not be found in the repository: PROPFIND request failed on '/svn/!svn/bc/61905/ipphone/branches/branch_trunk/phonex_supp/phonex/util/http/HttpConnection.cpp' '/svn/!svn/bc/61905/ipphone/branches/branch_trunk/phonex_supp/phonex/util/http/HttpConnection.cpp' path not found
Some things are always checked during upload, but most things aren't. This hasn't actually changed at all. Still, verifying that the patch is good when it's uploaded is something we really, really ought to be doing.
-
- Priority-Medium + Priority-High + Component-Reviews -
+ ReviewBoard does not verify patch when uploading
bug 522 has been merged into this issue. 522 really asks for a fix for "svn copy". Rejecting it is merely a workaround for the crash.
I noticed that diff 5 on this review has the same problem (I didn't post it, not sure how an invalid path was posted): http://reviews.review-board.org/r/527/diff/5/
My comment is more about Bug 522 : "svn copy" followed by "svn diff": Subversion 1.5 is able to provide a somewhat correctly looking diff: Index: targetver_copy.h =================================================================== --- targetver_copy.h (revision 152) +++ targetver_copy.h (working copy) @@ -11,3 +11,4 @@ #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. #endif +// A tiny change In this example the diff correctly shows a tiny change and the base revision yet contains the new name. RB fails to find this new name in SVN and rejects the patch. Do you guys have a way to encode "I have copied a file and want to diff against its predecessor" information in the patch? If so, perhaps the quick fix would be to write a script to process such changes?
This appears to be fixed these days. I don't know when, but certainly in 1.5 it's no longer a problem.
-
- Confirmed + Fixed
We still run in to this on an almost daily basis. In our case it happens when you post a review for a Mercurial revision that is on top of some other revisions that haven't been pushed to the server yet. When you go to view the diff you get a message like: Diff currently unavailable. Error: The patch to 'tests/test_repository.py' didn't apply cleanly. The temporary files have been left in '/tmp/reviewboard.D5U2wT' for debugging purposes. `patch` returned: patching file /tmp/reviewboard.D5U2wT/tmpTJqk5x Hunk #1 FAILED at 86. Hunk #2 FAILED at 235. 2 out of 2 hunks FAILED -- saving rejects to file /tmp/reviewboard.D5U2wT/tmpTJqk5x-new.rej for every file in the diff. I think at the very least the server should perform a check when you hit the "Publish" button to make sure your diff applies before allowing you to publish it.
Bumped into this when updating a diff that had a parent with a diff that had the same parent (which I re-uploaded). Prior to this attempt I had been able to update it fine. Now it will appear to work on the upload dialog (if I forget the parent diff it correctly prevents the upload) and fail: The patch to '.project' didn't apply cleanly. The temporary files have been left in '/tmp/reviewboard.Pqwdm6' for debugging purposes. `patch` returned: patching file /tmp/reviewboard.Pqwdm6/tmpVG6SvM Reversed (or previously applied) patch detected! Assume -R? [n] Apply anyway? [n] Skipping patch. 1 out of 1 hunk ignored -- saving rejects to file /tmp/reviewboard.Pqwdm6/tmpVG6SvM-new.rej Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/ReviewBoard-1.6.9-py2.4.egg/reviewboard/diffviewer/views.py", line 151, in view_diff interdiffset, highlighting, True) File "/usr/lib/python2.4/site-packages/ReviewBoard-1.6.9-py2.4.egg/reviewboard/diffviewer/diffutils.py", line 1071, in get_diff_files large_data=True) File "/usr/lib/python2.4/site-packages/Djblets-0.6.19-py2.4.egg/djblets/util/misc.py", line 156, in cache_memoize data = lookup_callable() File "/usr/lib/python2.4/site-packages/ReviewBoard-1.6.9-py2.4.egg/reviewboard/diffviewer/diffutils.py", line 1070, in <lambda> enable_syntax_highlighting)), File "/usr/lib/python2.4/site-packages/ReviewBoard-1.6.9-py2.4.egg/reviewboard/diffviewer/diffutils.py", line 552, in get_chunks new = get_patched_file(old, filediff) File "/usr/lib/python2.4/site-packages/ReviewBoard-1.6.9-py2.4.egg/reviewboard/diffviewer/diffutils.py", line 374, in get_patched_file return patch(filediff.diff, buffer, filediff.dest_file) File "/usr/lib/python2.4/site-packages/ReviewBoard-1.6.9-py2.4.egg/reviewboard/diffviewer/diffutils.py", line 240, in patch raise Exception(_("The patch to '%s' didn't apply cleanly. The temporary " + Exception: The patch to '.project' didn't apply cleanly. The temporary files have been left in '/tmp/reviewboard.Pqwdm6' for debugging purposes. `patch` returned: patching file /tmp/reviewboard.Pqwdm6/tmpVG6SvM Reversed (or previously applied) patch detected! Assume -R? [n] Apply anyway? [n] Skipping patch. 1 out of 1 hunk ignored -- saving rejects to file /tmp/reviewboard.Pqwdm6/tmpVG6SvM-new.rej