[gnu.utils.bug] bugfix for GNU diff 1.7

juha@tds.kth.se (Juha Sarlin) (08/23/89)

GNU diff 1.7 gives incorrect output when comparing files, where the
first file consists of two concatenated copies of the second file.
This script demonstrates the error:

$ cat >file2
aaaa
bbbb
cccc
^D
$ cat file2 file2 >file1
$ diff file1 file2
3d2
< cccc
$ /usr/bin/diff file1 file2
4,6d3
< aaaa
< bbbb
< cccc

And here is my fix:

*** /tmp/,RCSt1a00302	Wed Aug 23 14:45:49 1989
--- io.c	Wed Aug 23 14:44:34 1989
***************
*** 374,380 ****
      beg0 = filevec[0].prefix_end - 1;
    else
      beg0 = (filevec[0].prefix_end - 1
! 	    + filevec[1].buffered_chars - filevec[0].buffered_chars);
  
    /* Scan back until chars don't match or we reach that point.  */
    while (p0 != beg0)
--- 374,380 ----
      beg0 = filevec[0].prefix_end - 1;
    else
      beg0 = (filevec[0].prefix_end - 1
! 	    + filevec[0].buffered_chars - filevec[1].buffered_chars);
  
    /* Scan back until chars don't match or we reach that point.  */
    while (p0 != beg0)
--
Juha Sarlin	juha@tds.kth.se