[gnu.utils.bug] diff 1.12

jay@silence.princeton.nj.us (Jay Plett) (03/01/90)

I wrote earlier today about "diff -r" dumping core.
I've found one bug.  Don't know if it's the one or not; could
well be (I'm at home right now on a 386i instead of the sensible
machines at work).  I have added an option to diff which selects
message storage (like done by paginate_flag).  I always use the
added option when I use -r.  This path through the code exercises
the bug reported here.  -l would also.

Anyhow, here's the diffs that fix the bug.  This is the wrong
fix; it was the simplest one for the moment.  The correct fix
should be sanity checks in either message() or concat().
message() is sometimes called with two arguments but it requires
three, none of them zero.

*** /tmp/,RCSt1a21875   Wed Feb 28 20:49:48 1990
--- analyze.c   Wed Feb 28 20:43:10 1990
***************
*** 686,694 ****
        && output_style != OUTPUT_RCS)
      {
        if (filevec[0].missing_newline)
!       message ("No newline at end of file %s\n", filevec[0].name);
        if (filevec[1].missing_newline)
!       message ("No newline at end of file %s\n", filevec[1].name);
      }
  
    /* Allocate vectors for the results of comparison:
--- 686,694 ----
        && output_style != OUTPUT_RCS)
      {
        if (filevec[0].missing_newline)
!       message ("No newline at end of file %s\n", filevec[0].name, "");
        if (filevec[1].missing_newline)
!       message ("No newline at end of file %s\n", filevec[1].name, "");
      }
  
    /* Allocate vectors for the results of comparison:


	...jay

jay@silence.princeton.nj.us (Jay Plett) (03/01/90)

The bug fix I sent a while ago isn't the bug I reported earlier
today.  I'm repeating the bug on a SS1, diff compiled without
optimization, in a different pair of directories.  Nothing like
the pair of files I reported earlier (empty file, file full of
nulls) exists in this pair of directories, so that was a red
herring.

Now adb is printing stack traces for me:
core file = core -- program ``diff''
SIGSEGV 11: segmentation violation
$c
_find_equiv_class(0x3d,0x80,0xf7fffa78,0xf7fffb0c,0x10c00,0x15b68) + 34
_read_files(0x1,0x10c00,0x0,0x0,0x10584,0x1fd) + 284
_diff_2_files(0xf7fffa78,0x1,0x0,0x80,0xf7fffa78,0x94) + 5c
_compare_files(0x0,0x59c,0x3cec,0x11b78,0x1,0x2) + ca8
_diff_dirs(0xf7fffef9,0xf7fffefb,0x2c68,0x0,0x42,0x45) + 260
_compare_files(0x1,0x580,0x3cd6,0xf7fffefb,0x0,0x2) + 6fc
_main(0xffffffff,0x10c00,0xa,0x10c00,0x10c00,0x10c00) + 7d8

	...jay