After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 627940 - char newline '\x0d' leads to inaccurate highlights file differences
char newline '\x0d' leads to inaccurate highlights file differences
Status: RESOLVED FIXED
Product: meld
Classification: Other
Component: filediff
1.3.x
Other Linux
: Normal critical
: ---
Assigned To: Kai Willadsen
Stephen Kennedy
: 640199 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-08-25 12:56 UTC by Sam Bancal
Modified: 2011-01-21 22:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
example of 2 files with '\x0d' chars in meld (251.19 KB, image/png)
2010-08-25 12:56 UTC, Sam Bancal
  Details
1st file to meld (2.34 KB, text/plain)
2010-08-30 06:30 UTC, Sam Bancal
  Details
2nd file to meld (1.25 KB, text/plain)
2010-08-30 06:31 UTC, Sam Bancal
  Details
Patch for testing (6.30 KB, patch)
2010-10-26 21:10 UTC, Kai Willadsen
none Details | Review

Description Sam Bancal 2010-08-25 12:56:11 UTC
Created attachment 168728 [details]
example of 2 files with '\x0d' chars in meld

Steps to reproduce the bug :
----------------------------
Comparing two files having '\x0d' new line characters.

Meld Behavior :
---------------
Meld does break the line, but the highlights doesn't take it into account.
This leads to inaccurate highlights for that section and an offset in the highlights for the remaining parts of the files.

How often does this happen :
----------------------------
100% reproducible.

Expected behavior :
-------------------
On of the following :
a) both line break and highlights don't take into account the '\x0d' characters
b) both line break and highlights do take into account the '\x0d' characters

Screenshot attached.

Thanks.
SB
Comment 1 Sam Bancal 2010-08-26 10:54:03 UTC
Problematic on :
----------------
OS : Ubuntu linux 10.04 (32b)
Python : Python 2.6.5

Does work on :
--------------
OS : Ubuntu linux 8.04 (32b)
Python : Python 2.5.2
Comment 2 Kai Willadsen 2010-08-29 00:57:38 UTC
Could you please attach the files in question? It would be useful to have a test case. Also, what version of Meld are you using?

This looks like it's related to some Ubuntu bug with Python's universal newline support - this has cropped up in another situation as well. However, we should try to deal with the case anyway.
Comment 3 Sam Bancal 2010-08-30 06:30:37 UTC
Created attachment 169033 [details]
1st file to meld
Comment 4 Sam Bancal 2010-08-30 06:31:03 UTC
Created attachment 169034 [details]
2nd file to meld
Comment 5 Sam Bancal 2010-08-30 06:33:20 UTC
Thanks for your interest!

Meld versions are :
Ubuntu 10.04 -> meld 1.3.0
Ubuntu 8.04  -> meld 1.1.5.1
Comment 6 Kai Willadsen 2010-10-03 22:35:00 UTC
Right, so this does seem to be an Ubuntu bug. Somehow, Python's universal newline handling is broken in Ubuntu, and since Meld relies upon it for reading non-\n files, you're seeing this bug.

The only way we'd work around this is to provide our own version of universal newline support. This might happen in a unicode rework, but it's a fairly significant change otherwise.
Comment 7 Sam Bancal 2010-10-04 07:17:24 UTC
Ok.

That problem has been reported to Ubuntu as well :
https://bugs.launchpad.net/ubuntu/+source/meld/+bug/578121

I guess the best correction to be done then is on ubuntu's python implementation of new line.
Comment 8 Kai Willadsen 2010-10-26 21:10:57 UTC
Created attachment 173288 [details] [review]
Patch for testing

This patch is actually to deal with bug 602933, but should fix this as well.

Could you please test this patch and see whether it fixes the bug? It does for me, but in order to see the bug in the first place, I have to contort my setup, so it would be nice to see whether it does for you as well.
Comment 9 Sam Bancal 2010-11-04 13:58:48 UTC
I was not so comfortable with git and patch, but I've done it yet.

Yes! The code out from git, patched worked perfectly for me.
Thank you,

How are things happening now?
Comment 10 Kai Willadsen 2010-11-23 09:23:23 UTC
I've pushed the above patch to git HEAD, so closing this bug. Thanks for the bug report and for the testing.
Comment 11 Kai Willadsen 2011-01-21 22:21:38 UTC
*** Bug 640199 has been marked as a duplicate of this bug. ***