[Issue 259] New - cvs status fails to pa rse some entries in CVS/Entries

[email protected] 5 Jul 2005 09:13:03 -0000
Newsgroups gmane.comp.version-control.cvs.issuezilla
Message-ID <[email protected]>
https://ccvs.cvshome.org/issues/show_bug.cgi?id=259
                 Issue #|259
                 Summary|cvs status fails to parse some entries in CVS/Entries
               Component|ccvs
                 Version|1.12.12
                Platform|Sun
                     URL|
              OS/Version|All
                  Status|NEW
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P3
            Subcomponent|status
             Assigned to|issues@ccvs
             Reported by|mschwarzenberg






------- Additional comments from [email protected] Tue Jul  5 02:13:03 -0700 2005 -------
The following CVS/Entries for two files test1.c, and test2.c

  /test1.c/1.8/Result of merge//
  /test2.c/1.1.2.2/*Fri Nov 19 13:34:50 2004//TTESTBRANCH

apparently resulting from 
  cvs update -A

(where test2.c exists only in the branch)
result in the following 
  cvs status test1.c test2.c 
output:

===================================================================
File: test1.c         Status: Locally Modified

   Working revision:    1.8     cvs status: Can't parse date/time: `Result of
merge UTC'.
Result of merge UTC
   Repository revision: 1.8     /tmp/cvsroot/prj/test1.c,v
   Sticky Tag:          (none)
   Sticky Date:         (none)
   Sticky Options:      (none)

 ===================================================================
File: no file test2.c                Status: Needs Checkout

   Working revision:    1.1.2.2 cvs status: Can not parse date/time: `*Fri Nov
19 13:34:50 2004 UTC'.
*Fri Nov 19 13:34:50 2004 UTC
   Repository revision: 1.1.2.2 /tmp/cvsroot/prj/Attic/test2.c,v
   Commit Identifier:   (none)
   Sticky Tag:          TESTBRANCH (branch: 1.1.2)
   Sticky Date:         (none)
   Sticky Options:      (none)

This again is bad input for cvs frontends, e.g. it makes tkcvs crash.

The following patch fixes the issue by discarding non-parseable dates / skipping
the leading "*". However I'm not shure if there are other non-date entries which
should be suppressed, too.

--- src/status.c.orig   2005-03-17 14:42:26.000000000 -0500
+++ src/status.c        2005-07-05 03:20:02.865471885 -0500
@@ -217,12 +217,24 @@
     }
 #endif
     else
-    {
+    { 
+       const char *dateToParse = vers->ts_rcs;
+       int do_output = 1;
        cvs_output ("   Working revision:\t", 0);
        cvs_output (vers->vn_user, 0);
-
+
+       /* Skip possible leading '*' from dead revisions */
+       if(dateToParse[0]=='*')
+           dateToParse++;
+
+       /* Check if there is a time to use. */
+       if(strlen(dateToParse) == 0) 
+           do_output = 0;
+       else if(!strcmp(dateToParse, "Result of merge"))
+           do_output = 0;
+
        /* Only add the UTC timezone if there is a time to use. */
-       if (strlen (vers->ts_rcs) > 0)
+       if (do_output)
        {
            /* Convert from the asctime() format to ISO 8601 */
            char *buf;
@@ -230,7 +242,7 @@
            cvs_output ("\t", 0);
 
            /* Allow conversion from CVS/Entries asctime() to ISO 8601 */
-           buf = Xasprintf ("%s UTC", vers->ts_rcs);
+           buf = Xasprintf ("%s UTC", dateToParse);
            cvs_output_tagged ("date", buf);
            free (buf);
        }

# End of patch