eggert@WHEATIES.AI.MIT.EDU (Paul Eggert) (04/08/89)
If more than one input difference from the same pair of files contributes to the same overlapping difference, diff3 version 1.4 reports a high line number by mapping from the first input difference, but it should be mapping from the last input difference. As a result, diff3 does not output all the lines that it should. Here is an example. Suppose we have the following files. File 'a' contains: a b c d File 'b' contains: 1 2 3 4 5 6 d File 'c' contains: X b Y c d Then 'diff3 a b c' should output: ==== 1:1,3c a b c 2:1,6c 1 2 3 4 5 6 3:1,4c X b Y c Instead, it outputs: ==== 1:1,3c a b c 2:1,6c 1 2 3 4 5 6 3:1,3c X b Y The last line of output is missing, and the last 1,3c should be a 1,4c. Here is a fix. =================================================================== RCS file: RCS/diff3.c,v retrieving revision 1.2 retrieving revision 1.3 diff -c -r1.2 -r1.3 *** /tmp/,RCSt1001211 Fri Apr 7 14:38:53 1989 --- /tmp/,RCSt2001211 Fri Apr 7 14:38:54 1989 *************** *** 673,679 **** if (using[0]) { low1 = D_LOW_MAPLINE (using[0], FILE0, FILE1, lowc); ! high1 = D_HIGH_MAPLINE (using[0], FILE0, FILE1, highc); } else { --- 673,679 ---- if (using[0]) { low1 = D_LOW_MAPLINE (using[0], FILE0, FILE1, lowc); ! high1 = D_HIGH_MAPLINE (last_using[0], FILE0, FILE1, highc); } else { *************** *** 688,694 **** if (using[1]) { low2 = D_LOW_MAPLINE (using[1], FILE0, FILE1, lowc); ! high2 = D_HIGH_MAPLINE (using[1], FILE0, FILE1, highc); } else { --- 688,694 ---- if (using[1]) { low2 = D_LOW_MAPLINE (using[1], FILE0, FILE1, lowc); ! high2 = D_HIGH_MAPLINE (last_using[1], FILE0, FILE1, highc); } else { -- Paul Eggert, Twin Sun, Inc. <uunet!twinsun!eggert>