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 12:30:57 -0800

The following has a revised sanity.sh that works with remotecheck.

It might also be useful to write a test that does a 

  rm -f empty.msg
  touch empty.msg
  cvs commit -F empty.msg

to exercise that code path as well...

        Enjoy!
        -- Mark

ChangeLog Entry:
2003-02-16  Mark D. Baushke  <mdb@cvshome.org>

        * logmsg.c (logfile_write): Do not pass a NULL pointer to
        fprintf() when we have an empty log message.
        (Reported by Piotr KUCHARSKI <chopin@sgh.waw.pl>.)
        * sanity.sh (editor): Add new tests to verify correct behavior of
        empty log messages.

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
--- sanity.sh   15 Feb 2003 05:29:38 -0000      1.758
+++ sanity.sh   16 Feb 2003 20:26:30 -0000
@@ -12363,6 +12363,97 @@ 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 Start-Log;cat;echo End-Log) >> 
\$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...
+         if $remote; then
+           dotest editor-emptylog-continue-4r \
+"cat ${CVSROOT_DIRNAME}/CVSROOT/commitlog" \
+"Start-Log
+Update of ${CVSROOT_DIRNAME}/first-dir
+In directory ${hostname}:${TMPDIR}/cvs-serv[0-9a-z]*
+
+Modified Files:
+       file1 
+Log Message:
+
+End-Log"
+          else
+           dotest editor-emptylog-continue-4 \
+"cat ${CVSROOT_DIRNAME}/CVSROOT/commitlog" \
+"Start-Log
+Update of ${CVSROOT_DIRNAME}/first-dir
+In directory ${hostname}:${TESTDIR}/1/first-dir
+
+Modified Files:
+       file1 
+Log Message:
+
+End-Log"
+         fi
+         # 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 \*\*\*
+============================================================================="
+
+         # clean up
+         if $keep; then
+           echo Keeping ${TESTDIR} and exiting due to --keep
+           exit 0
+         fi
+
+         # restore the default loginfo script
+         rm -f ${CVSROOT_DIRNAME}/CVSROOT/loginfo,v \
+                ${CVSROOT_DIRNAME}/CVSROOT/loginfo \
+                ${CVSROOT_DIRNAME}/CVSROOT/commitlog
+         dotest editor-emptylog-continue-cleanup-1 "${testcvs} init" ''
+
          cd ../..
          rm -r 1
          rm ${TESTDIR}/editme




reply via email to

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