Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 1741 by December1981: Stray control characters with perforce diff

*NOTE: Do not post confidential information in this bug report.*

What version are you running?

What steps will reproduce the problem?
1. Add, say, a carriage return character \r directly to a file under perforce
2. Post a review with this edited file in the perforce changelist
3. patch will have trouble understanding the diff, as it will have \n\n in the middle of the diff

Please provide any additional information below.

I got round this by adding the two lines below (after line 104 in

       diff = convert_line_endings(diff)
-->    # filter any strings of \n characters >= 2 in the middle of the diff
-->    diff = re.sub(r'\n{2,}(.)', r'\n\1', diff)

This was a temporary fix for me - it doesn't capture the additions to the file in this pathological case, but it stops the exception generated when patch returns a failure (and if there were other genuine differences in the file, these would appear normally in the diff view)

I also noticed that has the following lines of code at line 79

    temp = data.replace('\r\r\n', '\n')
    temp = data.replace('\r\n', '\n')
    temp = temp.replace('\r', '\n')

Shouldn't the second line be ?

    temp = temp.replace('\r\n', '\n')

You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to