bug-cvs
[Top][All Lists]
Advanced

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

cvs doesn't checkout correct revision in vendor branch with -D date


From: FUJISHIMA Satsuki
Subject: cvs doesn't checkout correct revision in vendor branch with -D date
Date: Mon, 27 Nov 2000 02:28:26 +0900
User-agent: Wanderlust/2.5.1 (Smooth) SEMI/1.13.7 (Awazu) FLIM/1.13.2 (Kasanui) Emacs/20.7 (i386--freebsd) MULE/4.1 (AOI)

>Submitter-Id:   net
>Originator:     FUJISHIMA Satsuki
>Organization:
net
>Confidential:  no
>Synopsis:      cvs doesn't checkout correct revision in vendor branch with -D 
>date
>Severity:      serious
>Priority:      medium
>Category:      cvs
>Class:         sw-bug
>Release:       cvs-1.11
>Environment:
System: FreeBSD souffle.bogus-local.net 5.0-CURRENT FreeBSD 5.0-CURRENT #308: 
Fri Sep 8 21:34:54 JST 2000 
k5@souffle.bogus-local.net:/home/src/sys/compile/SOUFFLE i386

>Description:
        A commandline:
        $ cvs co -D"XX/YY/2000 UTC" src/foo.c
        creates incorrect revision of src/foo.c when
        o src/foo.c was made by cvs import.
        o It has only vendor branch.
        o src/foo.c is in Attic at the specified date.

>How-To-Repeat:

$ echo VERSION1 > VERSION
$ cvs import -m"this is version1" test cvstest version1
cvstest version1
N test/VERSION

No conflicts created by this import

$ echo VERSION2 > VERSION
$ cvs import -m"this is version2" test cvstest version2
cvstest version2
U test/VERSION

No conflicts created by this import

$ cvs co test
cvs checkout: Updating test
U test/VERSION
$ cat test/VERSION
VERSION2
### This is correct. But unrelated to this report due to lack of -D date. ###

$ cvs log test

RCS file: /home/k5/share/src/cvs/test/VERSION,v
Working file: test/VERSION
head: 1.1
branch: 1.1.1
locks: strict
access list:
symbolic names:
        version2: 1.1.1.2
        version1: 1.1.1.1
        cvstest: 1.1.1
keyword substitution: kv
total revisions: 3;     selected revisions: 3
description:
----------------------------
revision 1.1
date: 2000/11/12 10:57:16;  author: k5;  state: Exp;
branches:  1.1.1;
Initial revision
----------------------------
revision 1.1.1.2
date: 2000/11/12 11:00:18;  author: k5;  state: Exp;  lines: +1 -1
this is version2
----------------------------
revision 1.1.1.1
date: 2000/11/12 10:57:16;  author: k5;  state: Exp;  lines: +0 -0
this is version1
=============================================================================

$ cvs co -D'11/12/2000 11:01:00 UTC' test
cvs checkout: Updating test
U test/VERSION
$ cat test/VERSION 
VERSION2
### This is correct. ###

$ rm -r test
$ cd test; rm VERSION; cvs rm VERSION
cvs remove: scheduling `VERSION' for removal
cvs remove: use 'cvs commit' to remove this file permanently
$ cvs commit -m"good bye"
cvs commit: Examining .
Removing VERSION;
/home/k5/share/src/cvs/test/VERSION,v  <--  VERSION
new revision: delete; previous revision: 1.1.1.2
done
### test/VERSION has gone away. The problem starts here. ###

$ cd ..
$ rm -r test
$ cvs co -D'11/12/2000 11:01:00 UTC' test
cvs checkout: Updating test
U test/VERSION
$ cat test/VERSION
VERSION1
$ cat test/CVS/Entries
/VERSION/1.1/Sat Nov 12 10:57:16 2000//D2000.11.12.11.01.00
### This should be 1.1.1.2. ###

>Fix:

Apply a patch below; This bug was found by John Polstra
<jdp@polstra.com>, the author of CVSup. He fixed this and committed it
into FreeBSD repository. I report this issue for him due to his lack
of time.

According to log message:

RCS file: /home/ncvs/src/contrib/cvs/src/rcs.c,v
----------------------------
revision 1.21
date: 2000/10/29 03:56:49;  author: jdp;  state: Exp;  lines: +4 -2
Fix a bug that shows up when checking out files by date with the
"-D date" command line option.  There is code in the original to
handle a special case.  If the date search finds revision 1.1 it
is supposed to check whether revision 1.1.1.1 has the same date
stamp, which would indicate that the file was originally brought
in with "cvs import".  In that case it is supposed to return the
vendor branch version 1.1.1.1.

However, there is a bug in the code.  It actually compares the date
of revision 1.1 for equality with the date given on the command
line -- clearly wrong.  This commit fixes the coding bug.

There is an additional bug which is _not_ fixed in this commit.
The date comparison should not be a strict equality test.  It should
allow a fudge factor of, say, 2-3 seconds.  Old versions of CVS
created the two revisions with two separate invocations of the RCS
"ci" command.  We have many old files in the tree in which the
dates of revisions 1.1 and 1.1.1.1 differ by 1 second.

Approved by:    peter
----------------------------

To fix:
--- cvs/src/rcs.c       2000/10/02 06:43:56     1.20
+++ cvs/src/rcs.c       2000/10/29 03:56:49     1.21
@@ -2900,8 +2900,10 @@
        p = findnode (rcs->versions, "1.1.1.1");
        if (p)
        {
+           char *date_1_1 = vers->date;
+
            vers = (RCSVers *) p->data;
-           if (RCS_datecmp (vers->date, date) != 0)
+           if (RCS_datecmp (vers->date, date_1_1) != 0)
                return xstrdup ("1.1");
        }
     }


NOTE: You can browse this code via CVSWeb at FreeBSD.org.
http://www.FreeBSD.org/cgi/cvsweb.cgi/src/contrib/cvs/src/rcs.c



reply via email to

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