[comp.sources.bugs] Bug in cdiff: matching wrong lines

creps@silver (Steve Creps) (05/09/88)

   I have noticed a bug in the cdiff program that was posted to
comp.sources.misc in a couple of versions in the last few months.
Sometimes the line that was matched as different is not marked
in the context output of the newer version of the input file.
Instead, a line next to it is incorrectly marked. This bug has
occurred in several files (used on MS-DOS), and occurred consistently
among the version posted early this year (or late last year), a newer
posted version which had been fixed for Turbo C, and a still newer
version which was a bug fix of another problem.
   Here is an example of output for diff -c you.h c:you.h

*** you.h
--- c:you.h
**************
*** 120,126
  gold0,uexp,urexp;
  	int uhunger;			/* refd only in eat.c and shk.c */
  	int uinvault;
! 	struct monst *ustuck;
  	int nr_killed[CMNUM+2];		/* used for experience bookkeeping */
  };
  
--- 120,126 -----
  	int uhunger;			/* refd only in eat.c and shk.c */
  	int uinvault;
  	struct monst *ustuck;
! 	int nr_killed[ALLMNUM];		/* used for experience bookkeeping */
  };
  
  #endif /* YOU_H /**/

   The same bug also occurred when invoked with no options, and with the
-b option, so it seems to be independent of the flags.

   I just did another test before posting this, and I think I have found
the problem. The first file was in Unix format (<LF>, no <CR>), and the
second file was in MS-DOS format (<LF><CR>). When I converted the first
file to MS-DOS format, the problem went away. It should still be fixed,
however, but I don't have time to look at it more closely right now. Maybe
something with the file modes. Anyone?

-	-	-	-	-	-	-	-	-	-
Steve Creps, Indiana University, Bloomington, "home of the Hoosiers"
	creps@silver.bacs.indiana.edu (192.12.206.2)
	{pur-ee,ihnp4!inuxc,rutgers,pyramid}!iuvax!silver!creps
	creps@iubacs.bitnet (forwarded)
"To dream... the unlintable dream..."