[comp.sources.bugs] CVS 1.2 bug: CVS commit dumps core on long file lists

lowell@tc.fluke.COM (Lowell Skoog) (05/30/91)

Symptom:
    When committing a large number of files (the list of file names
    exceeds 1000 characters), CVS dumps core before putting the user
    in an editor to enter a log message.

Work-around:
    Avoid using `cvs commit -a' when many files need to be
    committed.  Instead, commit the files in smaller groups.

Cause:
    During the commit process, CVS collects lists of all files that
    have been modified, added, removed, etc.  It puts these lists in
    a temporary file then allows the user to enter a log message.
    When creating the temporary file, CVS uses the fmt() function to
    break up the file lists into reasonable sized lines to avoid line
    wrap.  Unfortunately, the fmt() function provides space (in a
    fixed array) for a line of length MAXLINELEN (1000 bytes), while
    each list can be of length MAXLISTLEN (20000 bytes).  So, the
    potential length of a file list is longer than fmt() can handle.

Solution:
    Change the "line" array in fmt() to be of size MAXLISTLEN.

A patch file is attached below.  A copy of this message has been sent
to berliner@sun.com.

----------------------------------------------------------------------
Lowell Skoog  M/S 223B                             lowell@tc.fluke.COM
John Fluke Mfg. Co. Inc.  {uunet,uw-beaver,microsoft,sun}!fluke!lowell
P.O. Box 9090
Everett, WA, USA  98206-9090                            (206) 356-5283
----------------------------------------------------------------------

diff -c cvs/src/commit.c:1.1.1.1 cvs/src/commit.c:1.3
*** cvs/src/commit.c:1.1.1.1	Wed May 29 13:33:03 1991
--- cvs/src/commit.c	Wed May 29 13:33:03 1991
***************
*** 1,5 ****
  #ifndef lint
! static char rcsid[] = "$Id: commit.c,v 1.1.1.1 1991/02/22 16:33:40 lowell Exp $";
  #endif !lint
  
  /*
--- 1,5 ----
  #ifndef lint
! static char rcsid[] = "$Id: commit.c,v 1.3 1991/05/29 19:41:40 lowell Exp $";
  #endif !lint
  
  /*
***************
*** 517,523 ****
      char *instring;
      char *prefix;
  {
!     char line[MAXLINELEN];
      char *cp;
      int col;
  
--- 517,523 ----
      char *instring;
      char *prefix;
  {
!     char line[MAXLISTLEN];	/* UNOFFICIAL bug fix, was MAXLINELEN */
      char *cp;
      int col;