🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Juha Sarlin Wed, 23 Aug 1989 14:49
bugfix for GNU diff 1.7
#375
Author: Juha Sarlin
Date: Wed, 23 Aug 1989 14:49
42 lines
1389 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads