From owner-freebsd-bugs Fri Jun 15 20:20:37 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id CB3A237B40F for ; Fri, 15 Jun 2001 20:20:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.3/8.11.3) id f5G3K4o01263; Fri, 15 Jun 2001 20:20:04 -0700 (PDT) (envelope-from gnats) Received: from phaidor.thuvia.org (thuvia.demon.co.uk [193.237.34.248]) by hub.freebsd.org (Postfix) with ESMTP id 04B6737B401 for ; Fri, 15 Jun 2001 20:14:56 -0700 (PDT) (envelope-from mark@thuvia.demon.co.uk) Received: from dotar-sojat.thuvia.org (dotar-sojat.thuvia.org [10.0.0.4]) by phaidor.thuvia.org (8.11.3/8.11.3) with ESMTP id f5G3F6S02031 for ; Sat, 16 Jun 2001 04:15:18 +0100 (BST) (envelope-from mark@dotar-sojat.thuvia.org) Received: (from mark@localhost) by dotar-sojat.thuvia.org (8.11.4/8.11.4) id f5G3En399530; Sat, 16 Jun 2001 04:14:49 +0100 (BST) (envelope-from mark) Message-Id: <200106160314.f5G3En399530@dotar-sojat.thuvia.org> Date: Sat, 16 Jun 2001 04:14:49 +0100 (BST) From: Mark Valentine Reply-To: Mark Valentine To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: gnu/28189: [PATCH] fix for detecting empty CVS commit log message Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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