[gnu.utils.bug] 2 diff bugs, 1

blm@cxsea.UUCP (Brian Matthews) (04/12/89)

I've compiled the latest gnu diff from osu-cis (version 1.4, as of 26 Oct
1988), and found a couple of problems.  I compiled it with gcc 1.34 on a
System V Release 3 machine.

First, in diff3.c on line 112, there is an #ifdef _GNUCC, which needs to
be #ifdef __GNUC__ (for 1.34 gcc at least).  Although it hardly seems
worth it, a context diff is attached below.

Secondly, when a blank line is added at the beginning and end of a file,
a normal diff misses the one added at the end.  So, you get something
like the following:

$ echo 'Hello, earth' >file1
$ echo '\nHello, earth\n' >file2
$ ./diff file1 file2
0a1
> 
$ 

A diff -c works as expected.  Has anyone else seen this?  Anyone fixed
it?

As promised, the context diff for diff3.c:

*** orig/diff3.c	Mon Apr 10 14:41:11 1989
--- diff3.c	Mon Apr 10 14:41:24 1989
***************
*** 109,115 ****
  #include <ctype.h>
  #include "diff.h"
  
! #ifdef _GNUCC
  #define alloca __builtin_alloca
  #endif
  
--- 109,115 ----
  #include <ctype.h>
  #include "diff.h"
  
! #ifdef __GNUC__
  #define alloca __builtin_alloca
  #endif
  
-- 
Brian L. Matthews  blm@cxsea.UUCP   ...{mnetor,uw-beaver!ssc-vax}!cxsea!blm
+1 206 251 6098    Computer X Inc. - a division of Motorola New Enterprises