[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
I have written patch for gnu diffutils to handle windows and mac lines
From: |
Amores Perros |
Subject: |
I have written patch for gnu diffutils to handle windows and mac lines |
Date: |
Mon, 9 Oct 2006 12:25:55 -0400 |
I think I briefly exchanged email with Paul Eggert on this topic
months (or years?) ago, and he said he would entertain (or
consider entertaining) such a patch. I have now ported/patched
to a recent (post-2.8.7 I think) version of diffutils cvs trunk.
I'm not sure to where to send this, so this is just a guess.
(I cannot recall where I exchanged email with Paul before,
and cannot find any such.)
Perhaps anyone receiving this might be kind enough to
foward it somewhere appropriate? Thanks for any help.
==================
DESCRIPTION
I have ported the changes to diffutils to handle all three
line terminators (Unix=\n, Mac=\r, Win/Dos=\r\n).
I have changes to diff.c, diff.h, io.c, sdiff.c, and util.c.
Primarily of course these affect
find_and_hash_each_line (io.c)
lines_differ (util.c)
but there are some small differences elsewhere, in places
where the code looped looking for \n, and also a new
command argument:
-g/--ignore-line-terminators
BASELINE
Here is the diffutils/src/CVS/Entries file of my baseline:
/Makefile.am/1.11/Thu Jan 5 07:23:55 2006//
/analyze.c/1.23/Thu Jan 5 07:23:55 2006/-ko/
/cmp.c/1.39/Thu Jan 5 07:23:55 2006/-ko/
/context.c/1.17/Thu Jan 5 07:23:55 2006/-ko/
/diff.c/1.43/Thu Jan 5 07:23:55 2006/-ko/
/diff.h/1.27/Thu Jan 5 07:23:55 2006/-ko/
/diff3.c/1.45/Thu Jan 5 07:23:55 2006/-ko/
/dir.c/1.21/Thu Jan 5 07:23:55 2006/-ko/
/ed.c/1.9/Thu Jan 5 07:23:55 2006/-ko/
/ifdef.c/1.18/Mon Apr 12 07:44:35 2004/-ko/
/io.c/1.29/Thu Jan 5 07:23:55 2006/-ko/
/normal.c/1.7/Thu Jan 5 07:23:55 2006/-ko/
/sdiff.c/1.42/Thu Jan 5 07:23:55 2006/-ko/
/side.c/1.15/Mon Apr 12 07:44:35 2004/-ko/
/system.h/1.32/Thu Jan 5 07:23:55 2006/-ko/
/util.c/1.35/Thu Jan 5 07:23:55 2006/-ko/
(I tried to update my baseline recently, but I didn't see how
to avoid having to run the bootstrap again from scratch, and
I thought that I recalled it was pretty bad (slow and
expensive) over dialup, so I didn't want to try it again. I
apologize that my baseline isn't more recent.)
SIZE OF UNIFIED CONTEXT DIFFS
$ diff -u diff.c ../../../cvs_2006-01-04/diffutils/src/diff.c | wc
42 190 1741
$ diff -u diff.h ../../../cvs_2006-01-04/diffutils/src/diff.h | wc
21 123 918
$ diff -u io.c ../../../cvs_2006-01-04/diffutils/src/io.c | wc
372 1697 9748
$ diff -u sdiff.c ../../../cvs_2006-01-04/diffutils/src/sdiff.c | wc
18 113 989
$ diff -u util.c ../../../cvs_2006-01-04/diffutils/src/util.c | wc
283 1220 7019
CAVEATS
#1)
I tested this using the self-test suite I developed for WinMerge,
and WinMerge doesn't support tab-expansion (b/c it used a pre-2.7
diffutils engine), so none of my test cases exercise tab expansion.
#2)
There is some behavior change. Pairs of \r\n are now treated
as blank lines, whereas previously those were treated as lines with
a single (odd) character in them. An even larger change is that every
\r not followed by a \n now ends the line.
QUESTION
Will you still entertain this patch (I hope)?
How would you like me to send you the patch? That is, where should I
send it, and in what format?
Individual diff -u outputs (or "diff -U 8" or...?)? Gzipped separately?
Or would you like me to send both my original & modified files, all
gzipped together?
(This last format is my own preferred format, b/c I like to run a
visual diff tool
on the original & altered files.)
Or I could send my entire modified working folder, which of course
compiles under gcc.
I can send you my test perl script as well, if you like -- a 14Kb perl
script and
about 3Kb of test files -- just under 200 tests total, by no means
exhaustive, just
samplers really, but most of the tests are run in all three terminations styles.
(I can also do bzip2, or zip, if you prefer.)
Cordially,
Perry
- I have written patch for gnu diffutils to handle windows and mac lines,
Amores Perros <=