bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cvs-1.11.2: commit across multiple dirs -- log messages lost


From: Bolo
Subject: cvs-1.11.2: commit across multiple dirs -- log messages lost
Date: Mon, 25 Nov 2002 17:22:25 -0600

Multi-directory commits and message edits don't work in cvs-1.11.2.

If you try to use the same log message for multiple directories, you get
(as expected) the 
-----------------------------------------------------------------------------
Log message unchanged or not specified
a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
Action: (continue) 
-----------------------------------------------------------------------------
interaction after exiting from the editor.   If you then tell CVS to
edit the existing message with 'e', or to use the message for this
an all further commits with '!' .... the log message is entirely lost.

All CVS files scribbled on after the first directory will have the
log message lost and the log will be set to '*** empty log message ***'.
The scripts will get a '(null)' token.

This behavior is the result of a bug in logmsg.c:do_editor() which
deletes! the message before it can be edited or reused.   It looks like
someone tried to fix a memory leak and missed a few valid conditions.

This behavior is a bug new to cvs-1.11.2; it isn't rpesent in 1.11.p1

A simple, first pass, diff to fix the problem is to get rid of the
offending deletion, which returns the code to the state it was in
in cvs-1.11.1p1:
--------------------------------------------------------------------------
*** logmsg.c-dist       Mon Nov 25 16:17:55 2002
--- logmsg.c    Mon Nov 25 16:20:48 2002
***************
*** 356,366 ****
--- 356,368 ----
        (*messagep)[0] == '\0' ||
        strcmp (*messagep, "\n") == 0)
      {
+ #if 0
        if (*messagep)
        {
            free (*messagep);
            *messagep = NULL;
        }
+ #endif
        for (;;)
        {
            (void) printf ("\nLog message unchanged or not specified\n");
--------------------------------------------------------------------------
I've appended a longer diff which cleans up memory in all cases that
the original intended to do, yet does not lose the message to be
edited or to be reused.

This bug did major damage to our CVS repository by losing the history
comments for a few commits on a substantial number of documents.  Yikes.
Fortunately I was able to freeze the CVS tree and fix empty log
entries in the underlying RCS files ... by hand.

Bolo -- Josef T. Burger
--------------------------------------------------------------------------
*** logmsg.c-dist       Mon Nov 25 16:17:55 2002
--- logmsg.c    Mon Nov 25 16:45:11 2002
***************
*** 356,366 ****
        (*messagep)[0] == '\0' ||
        strcmp (*messagep, "\n") == 0)
      {
!       if (*messagep)
!       {
!           free (*messagep);
!           *messagep = NULL;
!       }
        for (;;)
        {
            (void) printf ("\nLog message unchanged or not specified\n");
--- 356,362 ----
        (*messagep)[0] == '\0' ||
        strcmp (*messagep, "\n") == 0)
      {
!       int     cleanup_message = 0;
        for (;;)
        {
            (void) printf ("\nLog message unchanged or not specified\n");
***************
*** 374,388 ****
                if (unlink_file (fname) < 0)
                    error (0, errno,
                           "warning: cannot remove temp file %s", fname);
                error (1, 0, "aborting");
            }
            else if (line_length == 0
!                    || *line == '\n' || *line == 'c' || *line == 'C')
                break;
            if (*line == 'a' || *line == 'A')
                {
                    if (unlink_file (fname) < 0)
                        error (0, errno, "warning: cannot remove temp file %s", 
fname);
                    error (1, 0, "aborted by user");
                }
            if (*line == 'e' || *line == 'E')
--- 370,396 ----
                if (unlink_file (fname) < 0)
                    error (0, errno,
                           "warning: cannot remove temp file %s", fname);
+               if (*messagep)
+               {
+                   free (*messagep);
+                   *messagep = NULL;
+               }
                error (1, 0, "aborting");
            }
            else if (line_length == 0
!                    || *line == '\n' || *line == 'c' || *line == 'C') {
!               cleanup_message++;
                break;
+           }
            if (*line == 'a' || *line == 'A')
                {
                    if (unlink_file (fname) < 0)
                        error (0, errno, "warning: cannot remove temp file %s", 
fname);
+                   if (*messagep)
+                   {
+                       free (*messagep);
+                       *messagep = NULL;
+                   }
                    error (1, 0, "aborted by user");
                }
            if (*line == 'e' || *line == 'E')
***************
*** 393,398 ****
--- 401,411 ----
                break;
            }
            (void) printf ("Unknown input\n");
+       }
+       if (cleanup_message && *messagep)
+       {
+           free (*messagep);
+           *messagep = NULL;
        }
      }
      if (line)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]