Date: Sat, 16 Jun 2001 04:14:49 +0100 (BST) From: Mark Valentine <mark@thuvia.demon.co.uk> To: FreeBSD-gnats-submit@freebsd.org Subject: gnu/28189: [PATCH] fix for detecting empty CVS commit log message Message-ID: <200106160314.f5G3En399530@dotar-sojat.thuvia.org>
next in thread | raw e-mail | index | archive | help
>Number: 28189 >Category: gnu >Synopsis: [PATCH] fix for detecting empty CVS commit log message >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jun 15 20:20:04 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Mark Valentine >Release: FreeBSD 5.0-CURRENT i386 >Organization: Thuvia Labs >Environment: System: FreeBSD dotar-sojat.thuvia.org 5.0-CURRENT FreeBSD 5.0-CURRENT #7: Thu Jun 7 16:34:58 BST 2001 root@dotar-sojat:/usr/obj/usr/src/sys/DOTAR i386 >Description: CVS attempts to detect an empty or unchanged log message from a commit log editing session, but misses a case where someone tries to abort a commit by deleting all but the CVS: lines before quitting the editor (it does detect the case where the leading blank line inserted by cvs is left in; note that the latest CVS sources don't appear to insert this blank line). The patch below detects this case, which I know has caught many people out over the years, but I'd always put down to the effects of a very simple detection algorithm rather than a bug (until I finally looked at the code just now, trying to be more clever than I'd had it down for). With this fix, all of the following ways of aborting a commit work: a) quit the edit without saving the temp file b) delete all lines in the file before saving and quitting c) delete all non-CVS: prefix lines before saving and quitting d) delete all non-CVS: prefix lines but for a single blank line before saving and quitting That is, the file must be either untouched after the edit (mtime), or must be empty or contain a single newline apart from any CVS: prefixed lines. You can do whatever you want with the CVS: lines, it's what's left once these are stripped which counts. Specifically, the patch fixes case (c). >How-To-Repeat: Delete all lines _not_ beginning with ``CVS:'' before quitting the editor when creating a cvs commit log message; watch your commit go through with an empty log message. >Fix: A version of this fix against the current CVS sources has been submitted to bug-cvs@gnu.org. Index: contrib/cvs/src/logmsg.c =================================================================== RCS file: /usr/cvs/src/contrib/cvs/src/logmsg.c,v retrieving revision 1.7 diff -u -r1.7 logmsg.c --- contrib/cvs/src/logmsg.c 2000/10/02 06:43:56 1.7 +++ contrib/cvs/src/logmsg.c 2001/06/16 02:20:58 @@ -339,7 +339,7 @@ error (0, errno, "warning: cannot close %s", fname); if (pre_stbuf.st_mtime == post_stbuf.st_mtime || - *messagep == NULL || + *messagep == NULL || (*messagep)[0] == '\0' || strcmp (*messagep, "\n") == 0) { for (;;) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106160314.f5G3En399530>