bug-cvs
[Top][All Lists]
Advanced

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

Re: cvs cores when no log message


From: Mark D. Baushke
Subject: Re: cvs cores when no log message
Date: Sun, 16 Feb 2003 02:20:54 -0800

Hi Piotr,

I have created a few test case rules for your problem core dump problem.
When I run this on an unmodified Solaris 7 box, I get

|  Segmentation Fault - core dumped
|  exit status was 139

in the check.log per your report (and of course the core dump means that
the lock file is not removed).

For GNU/Linux boxes with an fprintf(stderr, "%s", NULL) prints "(null)",
the problem is caught by looking at the commitlog message file that I
have loginfo create.

I suggest to someone with commit authority that the following patch be
incorporated into the cvs1-11-x-branch and top-of-tree.

        Enjoy!
        -- Mark

Index: src/ChangeLog
===================================================================
RCS file: /cvs/ccvs/src/ChangeLog,v
retrieving revision 1.2357
diff -u -p -r1.2357 ChangeLog
--- src/ChangeLog       15 Feb 2003 05:29:38 -0000      1.2357
+++ src/ChangeLog       16 Feb 2003 10:12:57 -0000
@@ -1,3 +1,11 @@
+2003-02-16  Mark D. Baushke  <address@hidden>
+
+       * logmsg.c (logfile_write): Do not pass a NULL pointer to
+       fprintf() when we have an empty log message.
+       (Reported by Piotr KUCHARSKI <address@hidden>.)
+       * sanity.sh (editor): Add new tests to verify correct behavior of
+       empty log messages.
+
 2003-02-14  Larry Jones  <address@hidden>
 
        * log.c (log_expand_revlist): Fix crashes in error cases.
Index: src/logmsg.c
===================================================================
RCS file: /cvs/ccvs/src/logmsg.c,v
retrieving revision 1.62
diff -u -p -r1.62 logmsg.c
--- src/logmsg.c        29 Aug 2002 05:00:59 -0000      1.62
+++ src/logmsg.c        16 Feb 2003 10:12:57 -0000
@@ -927,7 +927,7 @@ logfile_write (repository, filter, messa
     }
 
     setup_tmpfile (pipefp, "", changes);
-    (void) fprintf (pipefp, "Log Message:\n%s\n", message);
+    (void) fprintf (pipefp, "Log Message:\n%s\n", (message) ? message : "");
     if (logfp != (FILE *) 0)
     {
        (void) fprintf (pipefp, "Status:\n");
Index: src/sanity.sh
===================================================================
RCS file: /cvs/ccvs/src/sanity.sh,v
retrieving revision 1.758
diff -u -p -r1.758 sanity.sh
--- src/sanity.sh       15 Feb 2003 05:29:38 -0000      1.758
+++ src/sanity.sh       16 Feb 2003 10:12:58 -0000
@@ -12363,6 +12363,79 @@ Log message unchanged or not specified
 a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
 Action: (continue) ${PROG} \[[a-z]* aborted\]: aborted by user"
 
+         # Test CVS's response to a log message that is zero bytes
+         # in length. This caused core dumps in cvs 1.11.5 on Solaris
+         # hosts.
+         cd ..
+         dotest editor-emptylog-continue-1 "${testcvs} -q co CVSROOT/loginfo" \
+"U CVSROOT/loginfo"
+
+          cd CVSROOT
+         echo 'DEFAULT (echo ""; id; echo %{sVv}; date;cat) >> 
\$CVSROOT/CVSROOT/commitlog' > loginfo
+         dotest editor-emptylog-continue-2 "${testcvs} commit -m add loginfo" \
+"Checking in loginfo;
+${CVSROOT_DIRNAME}/CVSROOT/loginfo,v  <--  loginfo
+new revision: 1\.2; previous revision: 1\.1
+done
+${PROG} [a-z]*: Rebuilding administrative file database"
+
+         cd ../first-dir
+         cat >${TESTDIR}/editme <<EOF
+#!${TESTSHELL}
+sleep 1
+cp /dev/null \$1
+exit 1
+EOF
+         chmod +x ${TESTDIR}/editme
+         dotest editor-emptylog-continue-3 "echo c |${testcvs} -e 
${TESTDIR}/editme ci -f file1" \
+"${PROG} [a-z]*: warning: editor session failed
+
+Log message unchanged or not specified
+a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
+Action: (continue) Checking in file1;
+${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
+new revision: 1\.2; previous revision: 1\.1
+done"
+         # The loginfo Log message should be an empty line and not "(null)"
+         # which is what some fprintf() implementations do with "%s"
+         # format and a NULL pointer...
+         # expr does not deal well with matching a blank line at the
+         # end of the message, so add a known good non-blank token.
+         echo EOF >>${CVSROOT_DIRNAME}/CVSROOT/commitlog
+         dotest editor-emptylog-continue-4 \
+"tail -3 ${CVSROOT_DIRNAME}/CVSROOT/commitlog" \
+"Log Message:
+
+EOF"
+         # There should have an empty log message at this point
+         dotest editor-emptylog-continue-5 "${testcvs} log -N -r1.2 file1" \
+"
+RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
+Working file: file1
+head: 1\.2
+branch:
+locks: strict
+access list:
+keyword substitution: kv
+total revisions: 3;    selected revisions: 1
+description:
+----------------------------
+revision 1\.2
+date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: +0 -0
+\*\*\* empty log message \*\*\*
+============================================================================="
+
+         # restore the default loginfo script
+         rm -f ${CVSROOT_DIRNAME}/CVSROOT/loginfo,v 
${CVSROOT_DIRNAME}/CVSROOT/loginfo
+         dotest editor-emptylog-continue-cleanup-1 "${testcvs} init" \
+""
+
+         # clean up
+         if $keep; then
+           echo Keeping ${TESTDIR} and exiting due to --keep
+           exit 0
+         fi
+
          cd ../..
          rm -r 1
          rm ${TESTDIR}/editme




reply via email to

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