From jhein@timing.com  Mon Dec 17 04:35:34 2007
Return-Path: <jhein@timing.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B2C8716A417
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 17 Dec 2007 04:35:34 +0000 (UTC)
	(envelope-from jhein@timing.com)
Received: from Daffy.timing.com (w.timing.com [206.168.13.218])
	by mx1.freebsd.org (Postfix) with ESMTP id 6D18513C442
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 17 Dec 2007 04:35:34 +0000 (UTC)
	(envelope-from jhein@timing.com)
Received: from gromit.timing.com (gromit.timing.com [206.168.13.209])
	by Daffy.timing.com (8.13.1/8.13.1) with ESMTP id lBH4ZXYl023211;
	Sun, 16 Dec 2007 21:35:33 -0700 (MST)
	(envelope-from jhein@timing.com)
Received: from gromit.timing.com (localhost [127.0.0.1])
	by gromit.timing.com (8.14.1/8.14.1) with ESMTP id lBH4ZXIG083914;
	Sun, 16 Dec 2007 21:35:33 -0700 (MST)
	(envelope-from jhein@gromit.timing.com)
Received: (from jhein@localhost)
	by gromit.timing.com (8.14.1/8.14.1/Submit) id lBH4ZXID083913;
	Sun, 16 Dec 2007 21:35:33 -0700 (MST)
	(envelope-from jhein)
Message-Id: <200712170435.lBH4ZXID083913@gromit.timing.com>
Date: Sun, 16 Dec 2007 21:35:33 -0700 (MST)
From: John Hein <jhein@timing.com>
Reply-To: John Hein <jhein@timing.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: peter@freebsd.org
Subject: cvs -R doesn't handle non-existent tags
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         118759
>Category:       bin
>Synopsis:       cvs(1): cvs -R doesn't handle non-existent tags
>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:   Mon Dec 17 04:40:03 UTC 2007
>Closed-Date:    
>Last-Modified:  Mon Dec 17 04:51:13 UTC 2007
>Originator:     John Hein
>Release:        FreeBSD 6.3-PRERELEASE i386 (and 7.x & -current)
>Organization:
>Environment:

>Description:

When using -R (or CVSREADONLYFS), cvs update, if invoked with a
non-existent tag, will remove files instead of flagging an error.

>How-To-Repeat:

% env -i /usr/bin/cvs -v

Concurrent Versions System (CVS) 1.11.17-FreeBSD (client/server)

Copyright (c) 1989-2004 Brian Berliner, david d `zoo' zuhn, 
                        Jeff Polk, and other authors

CVS may be copied only under the terms of the GNU General Public License,
a copy of which can be found with the CVS distribution kit.

Specify the --help option for further information about CVS

% cd /usr/src/bin/mv

# Without using -R, cvs handles non-existent tags in a reasonable
# way...

% env -i /usr/bin/cvs up -r nonexistenttag; echo status: $?
cvs [update aborted]: no such tag nonexistenttag
status: 1

# If using -R, cvs, instead of flagging an error, removes [unmodified]
# files that don't have the tag.

% env -i /usr/bin/cvs -R up -r nonexistenttag; echo status: $?
cvs update: Updating .
cvs update: Makefile is no longer in the repository
cvs update: mv.1 is no longer in the repository
cvs update: mv.c is no longer in the repository
status: 0


In contrib/cvs/src/tag.c, tag_check_valid() returns early
if readonlyfs is true.  Thus it bypasses the tag checking
that is done without -R.


This isn't horrible since modified files won't be deleted.

But it's not marked as an error, so it's hard to detect if running the
cvs update from a script.  And if the script included tagging of
files, then you will silently miss tagging the files.  That is
just one example of a real problem caused by this bug.


>Fix:

I don't have a patch (presumably for src/tag.c) at the moment, but newer
versions of cvs (such as 1.12.13) include support for -R and don't suffer
from this problem.  I'm wondering if it just might be time to update cvs
in contrib.

Rather than patch the 1.11.17-FreeBSD version, I might just come up
with a patch that's an import of 1.12.13 (unless someone beats me to
it).

Not only does 1.12.13 support -R, but it has some nice new features
that I like, notably the ability to update (or diff, etc.) to a
specified date on a branch (e.g., cvs up -Pd -rFOO-1-2:20071207 or cvs
diff -rFOO-1-2:20050101 -rFOO-1-2:20070801).  Doing so is difficult
with the 1.11.17.

Are there any regression tests I can run that test cvs before
importing a new version to FreeBSD?

[peter@, one-time cvs-meister, cc'd for comment]
>Release-Note:
>Audit-Trail:
>Unformatted:
