Hi tech@,

I had a simple RCS file and opencvs didn't annotate it properly.

 cat -n $CVSROOT/test/text,v
     1  head    1.2;
     2  access;
     3  symbols
     4          start:1.1.1.1
     5          me:1.1.0.1;
     6  locks; strict;
     7  comment @# @;
     8
     9
    10  1.2
    11  date    2015.11.15.06.43.34;    author omm;      state Exp;
    12  branches;
    13  next    1.1;
    14
    15  1.1
    16  date    2015.11.15.06.40.34;    author omm;      state Exp;
    17  branches
    18          1.1.1.1;
    19  next    ;
    20
    21  1.1.1.1
    22  date    2015.11.15.06.40.34;    author omm;      state Exp;
    23  branches;
    24  next    ;
    25
    26
    27  desc
    28  @@
    29
    30
    31  1.2
    32  log
    33  @thing
    34  @
    35  text
    36  @no
    37  woman
    38  no
    39  cry
    40  @
    41
    42
    43  1.1
    44  log
    45  @Initial revision
    46  @
    47  text
    48  @d1 1
    49  d4 1
    50  @
    51
    52
    53  1.1.1.1
    54  log
    55  @hi
    56  @
    57  text
    58  @@


GNU cvs is correct...
$ cvs annotate text
Annotations for text
***************
1.2          (omm       15-Nov-15): no
1.1          (omm       15-Nov-15): woman
1.1          (omm       15-Nov-15): no
1.2          (omm       15-Nov-15): cry

$ opencvs annotate text
Annotations for text
***************
1.1          (omm       15-Nov-15): no
1.1          (omm       15-Nov-15): woman
1.1          (omm       15-Nov-15): no
1.1          (omm       15-Nov-15): cry

After appling patch (below) opencvs matches GNU cvs annotation and blame.

$ blame -V
blame 1.3.1; emulating RCS version 5

$ blame $CVSROOT/test/text,v | sha256
Annotations for text
***************
2bcdf1fddf23fecd0710bba4376ba21e394bc97a6a2403b5453320bcea109d5c

$ cvs ann text | sha256
Annotations for text
***************
2bcdf1fddf23fecd0710bba4376ba21e394bc97a6a2403b5453320bcea109d5c

$ opencvs ann text | sha256
Annotations for text
***************
2bcdf1fddf23fecd0710bba4376ba21e394bc97a6a2403b5453320bcea109d5c

I also tested this against a non-trival RCS file: r1.125 of OpenBSD's 
src/Makefile.

$ cvs ann Makefile | sha256
Annotations for Makefile
***************
335b6c5735636e8358db6058bd4e9e2bd3173c80e70a0fc1dd86f541a73eb1c7

$ opencvs ann Makefile | sha256
Annotations for Makefile
***************
335b6c5735636e8358db6058bd4e9e2bd3173c80e70a0fc1dd86f541a73eb1c7

Then I looked in history of rcs.c and found that my patch is
the opposite of a fix for an infinite loop bug...
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/cvs/rcs.c#rev1.298

Below patch is for reference only; it's what I applied to "fix" local annotate.
Did the previous infinite loop issue only affect server/remote mode of opencvs?

- Michael


Index: rcs.c
===================================================================
RCS file: /cvs/src/usr.bin/cvs/rcs.c,v
retrieving revision 1.313
diff -U 5 -p -r1.313 rcs.c
--- rcs.c       5 Nov 2015 09:48:21 -0000       1.313
+++ rcs.c       15 Nov 2015 08:29:18 -0000
@@ -1798,17 +1798,10 @@ again:
        for (;;) {
                if (rdp->rd_next->rn_len != 0) {
                        trdp = rcs_findrev(rfp, rdp->rd_next);
                        if (trdp == NULL)
                                fatal("failed to grab next revision");
-               } else {
-                       /*
-                        * XXX Fail, although the caller does not always do the
-                        * right thing (eg cvs diff when the tree is ahead of
-                        * the repository).
-                        */
-                       break;
                }
 
                if (rdp->rd_tlen == 0) {
                        if (rcsparse_deltatexts(rfp, rdp->rd_num))
                                fatal("rcs_rev_getlines: rcsparse_deltatexts");

Reply via email to