3866: mxml source file patches fail to get applied

kamald******@gmai***** (Google Code) (Is this you? Claim this profile.)
June 1, 2015
What version are you running?
1.6.6

What's the URL of the page containing the problem?
'View diff' for an mxml source file


What steps will reproduce the problem?
1. Make changes to an mxml source file (Flex Application)
2. Post the changes for review to reviewboard
3. The following error trace is observed:

Diff currently unavailable.
Error: The patch to '//projects/flash-client-dev/hdcore/v3.8/support-players/ZoroDebugPlayer/src/ZoroDebugPlayer.mxml' didn't apply cleanly. The temporary files have been left in '/tmp/reviewboard.Mwxe1l' for debugging purposes. `patch` returned: patching file /tmp/reviewboard.Mwxe1l/tmpKE4shz patch: **** malformed patch at line 5: <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
Details
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.6.6-py2.6.egg/reviewboard/diffviewer/views.py", line 217, in view_diff_fragment
    file = get_requested_diff_file()
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.6.6-py2.6.egg/reviewboard/diffviewer/views.py", line 193, in get_requested_diff_file
    get_chunks)
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.6.6-py2.6.egg/reviewboard/diffviewer/diffutils.py", line 1072, in get_diff_files
    large_data=True)
  File "/usr/local/lib/python2.6/dist-packages/Djblets-0.6.16-py2.6.egg/djblets/util/misc.py", line 157, in cache_memoize
    data = lookup_callable()
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.6.6-py2.6.egg/reviewboard/diffviewer/diffutils.py", line 1071, in <lambda>
    enable_syntax_highlighting)),
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.6.6-py2.6.egg/reviewboard/diffviewer/diffutils.py", line 553, in get_chunks
    new = get_patched_file(old, filediff)
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.6.6-py2.6.egg/reviewboard/diffviewer/diffutils.py", line 375, in get_patched_file
    return patch(filediff.diff, buffer, filediff.dest_file)
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.6.6-py2.6.egg/reviewboard/diffviewer/diffutils.py", line 243, in patch
    (filename, tempdir, patch_output))
Exception: The patch to '//projects/flash-client-dev/hdcore/v3.8/support-players/ZoroDebugPlayer/src/ZoroDebugPlayer.mxml' didn't apply cleanly. The temporary files have been left in '/tmp/reviewboard.Mwxe1l' for debugging purposes.
`patch` returned: patching file /tmp/reviewboard.Mwxe1l/tmpKE4shz
patch: **** malformed patch at line 5: <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"


What is the expected output? What do you see instead?

I should see the diff of the new commit vs. the previous commit

What operating system are you using? What browser?

Mac OS X 10.10.3 on Chrome 42. Also Safari 8.0.5.

Please provide any additional information below.

Here is the opening line causing the problem:

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
			   xmlns:s="library://ns.adobe.com/flex/spark"
			   xmlns:mx="library://ns.adobe.com/flex/mx"
			   xmlns:metadata="org.osmf.metadata.*"
			   xmlns:local="*"
			   width="100%" height="100%" applicationComplete="init()" backgroundAlpha="0"
			   backgroundColor="#444242" currentState="videotracestats" preloaderChromeColor="#BBBBBB"
			   stateChangeComplete="startDelayedResize()" >
david
#1 david
It would be very helpful to see the patch file in question, not just the source file.
  • +NeedInfo
#2 kamald******@gmai***** (Google Code) (Is this you? Claim this profile.)
This code is protected under license, but I can share the initial few lines if it helps. If not, I can just create a new mxml application to demonstrate this. Whichever is better:


--- //.../ZoroDebugPlayer/src/ZoroDebugPlayer.mxml	//.../ZoroDebugPlayer/src/ZoroDebugPlayer.mxml#2
+++ //.../ZoroDebugPlayer/src/ZoroDebugPlayer.mxml	2015-04-15 16:03:45
@@ -1,6 +1,6 @@
-<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
			   xmlns:s="library://ns.adobe.com/flex/spark"
			   xmlns:mx="library://ns.adobe.com/flex/mx"
			   xmlns:metadata="org.osmf.metadata.*"
			   xmlns:local="*"
			   width="100%" height="100%" applicationComplete="init()" backgroundAlpha="0"
			   backgroundColor="#444242" currentState="videotracestats" preloaderChromeColor="#BBBBBB"
			   stateChangeComplete="startDelayedResize()" >
	<!-- width="1250" height="770" viewSourceURL="srcview/index.html"-->
	<fx:Style source="Main.css"/>
	<s:states>  
		<s:State name="State1"/>
		<s:State name="video"/>
		<s:State name="videochart"/>
		<s:State name="videochartstats"/>
		<s:State name="videostats"/>
		<s:State name="videotrace"/>
		<s:State name="videotracechart"/>
		<s:State name="videotracestats"/>
		<s:State name="justPlayer"/>
	</s:states>
david
#3 david
Hrmph, ok. I really don't know why `patch` would say that it's malformed.

If you try applying that patch manually (by executing the patch command), does it work?
#4 kamald******@gmai***** (Google Code) (Is this you? Claim this profile.)
Nope, fails.

$ patch -p2 ZoroDebugPlayer.mxml ~/zdp.diff 
patching file ZoroDebugPlayer.mxml
patch: **** malformed patch at line 5: <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
#5 kamald******@gmai***** (Google Code) (Is this you? Claim this profile.)
The generated diff file does not look correct. I use perforce. The edited lines are not in the patch at all.

Maybe this is a p4 diff issue and not a ReviewBoard one?
david
#6 david
You created your diff via `p4 diff`? Could you try with `rbt diff`?
#7 kamald******@gmai***** (Google Code) (Is this you? Claim this profile.)
I am using a post-review script built on top of RBTools. I looked in the source and the way diff is done is using the unix diff command under the clients/perforce.py script.

diff_cmd = ['diff', '-urNp', old_file, new_file]

However, I installed RBTools and used rbt diff with my reviewboard server URL. These diff produces patchable files. But the diff was not accurate. The line additions do not seem to be the same as I expect.

Let me look at this a bit more to confirm.
chipx86
#8 chipx86
It's a bit more complex than that. We don't just shell out to diff. Rather, we use that as a base, and generate a more thorough diff that Review Board can read. This is custom to us, and requires RBTools.

post-review is old, and hasn't been part of RBTools for a couple years now, so it's not a safe bet for future use.

If you're still hitting trouble with using RBTools to post the change, run it with --debug and show us the output. We'll see what may be going wrong.
david
#9 david
  • -NeedInfo
    +UserError