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 547743 - Files whose only difference is line endings are shown as different
Files whose only difference is line endings are shown as different
Status: RESOLVED FIXED
Product: meld
Classification: Other
Component: general
1.2
Other Linux
: Normal normal
: ---
Assigned To: meld-maint
meld-maint
: 570389 743872 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-08-14 10:05 UTC by palfrey
Modified: 2015-02-10 19:45 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description palfrey 2008-08-14 10:05:35 UTC
I've got two files (different revisions of a program that should have been under revision control, but wasn't) that are marked in the Meld GUI as being different, but when I open them up there's no markings for different sections. Opening the two files up in vim shows me that the only difference is line endings, which was not apparent in Meld.

Meld should either have an option to ignore this, or to fix this for otherwise unchanged files (as opposed to the current option which only triggers when a file has been edited) with possibly some icon/other marking denoting that these files differ in line endings.
Comment 1 Kai Willadsen 2008-09-18 13:31:50 UTC
I don't think that Meld can't realistically show files that differ in only line endings (or similar criteria) as the same in the directory or version control view; doing that would require doing a (possibly very) slow comparison of each file in the tree.

Maybe some notification would be appropriate (maybe using something like gedit's message area?) that the files only differ in line endings. However, exposing all of the possibilities to fix that (make all DOS, make all unix, merge line endings left, merge line endings right, do nothing) might be a little excessive.
Comment 2 Stephen Kennedy 2008-09-25 22:12:11 UTC
Dirdiff already does a full comparison of the files with regex substitution etc, so it's not too bad to check line endings too. Maybe dirdiff _files_same should try to open files with universal line endings by default?

The hard part methinks is the UI. Meld needs a notification area + search bar etc for this to work.

As Kai says, I don't think this is practical for version control as it involves a roundtrip.


Comment 3 John Keller 2008-10-22 08:08:13 UTC
I'd think it would make the most sense to simply use the same preferences as defined in "Text Filters". After all, if I want to ignore those inside the file, it makes sense that I'd like to ignore them at the directory level too. So, if this preference option is added, why not add it there.

It would be great to have this, even if limited to local files. I use Meld almost exclusively on local files/directories, and it would be very useful to have the directory diffs correctly reflect what I'd see in the file diff (e.g. if I ignore extra lines in file contents, they're not flagged in the directory diffs).
Comment 4 Damjan 2009-02-05 08:16:07 UTC
*** Bug 570389 has been marked as a duplicate of this bug. ***
Comment 5 Damjan 2009-02-05 08:21:27 UTC
I second the comment #3. I thought that meld uses Text Filters in dirdiff and I think this would be the best approach - the most intuitive.
Comment 6 Kai Willadsen 2012-02-12 01:31:59 UTC
Just making notes for posterity.

We already use text filters in dirdiff. There's limits to this, but basically all text filters get applied. This doesn't actually help this bug however, since filters that change newlines (such as the filter you'd need to normalise line endings) break file comparisons.

Fixing this particular bug would have to look something like:

 * Sniff file for mime type
 * If it looks like text, try to open it as such using universal newlines
 * If it looks like binary, just treat it as bytes (this is what we currently do)
Comment 7 marcvangend 2012-10-05 12:06:21 UTC
I used the instructions from http://rootfs.wordpress.com/2011/03/09/ubuntu-ignore-line-ending-differences-in-the-meld-tool/ to achieve this behavior, which seemed to work fine in my case.

Quote from that site:
Edit -> Preferences -> Text Filters -> New a patten with a name something like “line ending” and regex “\r+$” and check the Active check box. Refresh or restart the Meld.
Comment 8 Kai Willadsen 2012-10-05 20:09:55 UTC
Just to explain why that solution can't be in Meld by default...

That will work fine in some cases, but break others badly. In particular, that will work if the line endings that differ are '\r\n' and '\n', and should have no noticeable effect in the actual file comparison either. However, if you're unlucky enough to have '\r' ending files, then you'll still get false positives in folder comparisons, *and* file comparisons will break badly (because the filter is changing the number of lines in the file, which we don't support).
Comment 9 Kai Willadsen 2015-02-02 21:19:29 UTC
*** Bug 743872 has been marked as a duplicate of this bug. ***
Comment 10 Kai Willadsen 2015-02-07 23:48:11 UTC
In current master, Meld now notifies in file comparisons if the files are identical, but have different line endings. This doesn't fix this bug, but at least it means that the user can see why the two views differ.
Comment 11 Kai Willadsen 2015-02-10 19:45:09 UTC
In current master, there is now a new (enabled by default) preference to apply text filters during folder comparisons. We've always done this; being able to turn it off is what's new. When this preference is enabled, we also normalise line endings, so files that are identical except for their line endings are shown in the same was as files that are identical once filters have been applied (normal weight and colour, with italics). This *does* fix the bug, and with the other change to filediff, it's also fairly obvious what happened at the per-file level.