1166: view diff failed for files contain Mac newline char (i.e. CR \r) -- use SVN client

ff**@datasyn******** (Google Code) (Is this you? Claim this profile.)
Jan. 22, 2012
1743
What version are you running?
RB 1.0rc2 on linux
RBTools-0.2beta1-py2.5 on windows

What's the URL of the page containing the problem?
click "view diff"

What steps will reproduce the problem?
1. in my svn repos, i have a file that uses \r as line separater in 
portions, make some change in working copy and use post-review to create 
review request 
2. click "view diff" it says "The patch to '/modules/cpp-
support/trunk/build/openssl/pom.win32-vc6.xml' didn't apply cleanly, blah 
blah"


What is the expected output? What do you see instead?
click "view diff" it says "The patch to '/modules/cpp-
support/trunk/build/openssl/pom.win32-vc6.xml' didn't apply cleanly, blah 
blah"


What operating system are you using? What browser?
run post-review on windows; ReviewBoard server on linux; SVN 

Please provide any additional information below.
As some portion of the file contains only \r, GNU diff doesn't treat it as 
a line separator, the generated patch file has very small line number in 
chunk range and long single context lines contains \r. However post-review 
sets 'universal_newlines=True' in execute(), when long context lines are 
splitted when "svn diff" returns from execute() and thus generates a 
corrupted patch file.
What's more review board also tries to normalize new lines in 
reviewboard/diffviewer/diffutils.py, so this will damage patches lines 
that contains only '\r'

I'm attaching the source file and the corrupted diff file, as you can see, 
also the chunk range says @@ -1,3 +1,3 @@, there are around a dozen 
context lines in the chunk.
#1 ff**@datasyn******** (Google Code) (Is this you? Claim this profile.)
my xml file contains only \r in some part. it's stored in SVN.

also upload the corrupted diff file, wireshark shows that it's already corrupted on 
the post-review side.
  • +
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    	<groupId>com.datasynapse.cpp-support 
    	</groupId>
    	<artifactId>openssl-win32</artifactId>
    	<packaging>pom</packaging>
    	<name />
    	<version>0.9.8h</version>
    	<description />
    	<parent>
    		<groupId>com.datasynapse.cpp-support</groupId>
    		<artifactId>includes-win32</artifactId>
    		<version>1.0.0.1</version>
    		<relativePath>pom.includes-win32.xml</relativePath>
    	</parent>
    	<properties>
    		<platform>win32</platform>
    		<platform.config>WIN32</platform.config>
    		<platform.config2>ms</platform.config2>
    		<compiler.name>vc6</compiler.name>
    		<archive.root>${platform}</archive.root>
    		<artifactId.suffix>${platform}-${compiler.name}</artifactId.suffix>
    		<pomFileName>pom.win32-vc6.xml</pomFileName>
    	</properties>
    </project>
    +
    Index: /modules/cpp-support/trunk/build/openssl/pom.win32-vc6.xml
    ===================================================================
    --- /modules/cpp-support/trunk/build/openssl/pom.win32-vc6.xml	(revision 71563)
    +++ /modules/cpp-support/trunk/build/openssl/pom.win32-vc6.xml	(working copy)
    @@ -1,3 +1,3 @@
     <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    	<groupId>com.datasynapse.cpp-support 
    	</groupId>
    	<artifactId>openssl-win32</artifactId>
    	<packaging>pom</packaging>
    	<name />
    	<version>0.9.8h</version>
    	<description />
    	<parent>
    		<groupId>com.datasynapse.cpp-support</groupId>
    		<artifactId>includes-win32</artifactId>
    		<version>1.0.0.1</version>
    		<relativePath>pom.includes-win32.xml</relativePath>
    	</parent>
    	<properties>
    		<platform>win32</platform>
    		<platform.config>WIN32</platform.config
chipx86
#2 chipx86
Would you mind upgrading to the nightly of RBTools? This should be fixed.

There will be a release in a few days, if you want to wait until then.
  • +NeedInfo
#4 ff**@datasyn******** (Google Code) (Is this you? Claim this profile.)
I couldn't figure out how to apply nightly post-review and review-board upgrades, is 
there any FAQ url? 
Thanks for the fix and the great product.
chipx86
#5 chipx86
Go ahead and grab the latest release. I released RC3 Saturday, which had these fixes.
#6 ff**@datasyn******** (Google Code) (Is this you? Claim this profile.)
It seemed it's not fixed for svn client on post-review side. I tried the RC3 release 
and RBTools 0.2beta2 nightly dev kit. 
david
#7 david
  • -NeedInfo
    +New
#8 lon***@gmai***** (Google Code) (Is this you? Claim this profile.)
Using the following file as an example (all termination characters are CR (or \r)):

Sample file.
Should contain only CR (\r) as
line termination.

(I used scite editor to convert an examine
the line termination.)


$ post-review -d -n default
>>> Processing add of //depot/prod/code-quality/code-review/rbtools/sample.cronly
>>> p4 -G where //depot/prod/code-quality/code-review/rbtools/sample.cronly
>>> diff -urNp /tmp/tmpFhtK-S /u/laurentn/p4/code-review/rbtools/sample.cronly
--- //depot/prod/code-quality/code-review/rbtools/sample.cronly
//depot/prod/code-quality/code-review/rbtools/sample.cronly#1
+++ //depot/prod/code-quality/code-review/rbtools/sample.cronly 2010-03-10 21:39:27
@@ -0,0 +1 @@
the line termination.)o convert an examine
\ No newline at end of file

========================================================================
Note that the issue really comes from the underlying diff utility.
This is with rbtools 0.2RC2 on linux, but the same issue is seen on Windows as well,
the whole file is seen as a single line by diff (though I only change scite to SciTE:
C:\Python25\Scripts>..\diff.exe sample.cronly sample2.cronly
1c1
the line termination.)o convert an examine
\ No newline at end of file
---
the line termination.)o convert an examine
\ No newline at end of file

C:\Python25\Scripts>
david
#9 david
  • +Component-RBTools
david
#11 david
Having investigated this a little more, there's really nothing we can do. Having mixed/partial line endings is fatal for almost any tool that needs to try to parse the file, and especially for something as complicated as review board. You'll find that everything works much, much better if you just fix the files in source control.
  • -New
    +WontFix