bug-cvs
[Top][All Lists]
Advanced

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

pvcs2rcs bug, but I have 2 fixes to contribute


From: Peter_Lenahan
Subject: pvcs2rcs bug, but I have 2 fixes to contribute
Date: Wed, 18 May 2005 13:54:21 -0400

I am not complaining, the scripts ran very well, there were a couple of
minor issues that I solved and I would like to share the solutions with
the author(s) of pvcs2rcs.
 
1 - Major Revision number change in PVCS causes "ci" in RCS to fail.
2 - Garbage character in Author Name causes "ci" in RCS to fail.
 
 
Thanks,
Peter Lenahan
 
=====================================Problem 1 with solution
============================
 
 
When you have a pvcs archive that has a change in the Major Revision
number.
 
Example 1.1, 1.2, 1.3.....  Then you jump to the next set of revision
numbers 2.1,2.2,2.3
 
RCS reports an error when you try update the archive that the file is
not locked.
 
This is the actual error message pvcs2rcs.log:ci: RCS/javasourcelist,v:
no lock set by pjl for revision 1.259.
>From that point on all revisions have errors.
 
To solve this problem, I placed the following Syntax into the Script
"pvcs2rcs".
This allowed the file to be locked before the "ci" was attempted and it
resolved the problem.
 
 
<                       $ci_command = $ci_base_command;
---
>                       #
>                       #  Add a lock to allow the RCS archive to skip
major revision numbers
>                       #
>                       $ci_command = "rcs -l -M RCS/$workfile,v;";
> 
>                       $ci_command .= $ci_base_command;
 
This was some of the junk from my pvcs vlog of the file that had the
problem, you can see that the revision numbers are all over the place.
This file is over 10 years old.
 
Version labels:
   "GUI" = 10.*
   "PPP" = 1.0
   "JAVA_331B1" = 1.40.1.3
   "JDK1" = 1.59.2.32
   "JAVA_331_FINAL" = 1.59.1.3
   "WF332" = 1.126.1.3
   "WEB332A" = 1.180.1.0
   "WEB332B" = 1.180.1.23.1.0
   "JAVA_331_PATCH" = 1.59.1.3
   "FIRSTBANK332A" = 1.180.1.0.1.0
   "WEB421A" = 2.58.1.15
   "J332B_PATCH1" = 1.180.1.23.1.6
   "WEB421L" = 1.180.1.23.1.9
   "WEBBOKERDEMO" = 1.180.1.46
   "WEB421AP1" = 2.58.1.20
   "JAVA43" = 2.171
   "WEB43P1" = 2.171.1.3
   "WEB43FINAL" = 2.171
   "WEB43UNIX" = 2.171
   "WEB435_PR" = 2.222
   "WEB435" = 3.22.1.7.1.1
   "WEB435P1" = 3.22.1.9.1.20
   "WEB435DB" = 3.22.1.13
   "JAVA436" = 3.250.1.24
   "JAVA436_201" = 3.250.1.19
   "JAVA436P1" = 3.250.1.26.1.9
   "JAVA436RA" = 3.250.1.56.1.0
   "JAVA436P1_2_28" = 3.250.1.26.1.0
 
 
In pvcs this is my script to change the pvcs revision label
 
dir=tmp__javabumplabel$$
cd /tmp
mkdir $dir
cd $dir
 
filename=$1
 
GET_J -vGUI $filename
typeset -i majorrevision
majorrevision=$(getrev ${filename} | sed -e's/\..*//')
toprevision=$(getrev ${filename})
majorrevision=$majorrevision+1
newrevision=${majorrevision}.0
sedtempfile=/tmp/$$.sed
echo "1,5s/${toprevision}/${newrevision}/" > $sedtempfile
mv $filename $filename.base
sed -f $sedtempfile ${filename}.base > ${filename}
head -3 ${filename}.base
head -3 ${filename}
 
vcs -l -r${toprevision} ${filename}
put -M'updated rev to $majorrevision' -r${newrevision} $filename
vcs -y -vGUI:${majorrevision}.* ${filename}
cd /tmp
rm -f -r $dir
 
 
 
 
 
=====================================Problem 1 with solution
============================
 
=====================================Problem 2 with solution
============================
 
When the name of the person in the PVCS archive has invalid RCS
characters in the string RCS ci rejects the checkin
 
In my case the user had a ":." Characters in his username.
 
673a674,677
>                                       #
>                                       # remove leading : characters
from the names which cause problems in rcs
>                                       #
>                                       # This was my solution, but it
is not general enough
>                                       # see below for a general
solution
>
$author{$rev_num[$rev_index]}=~s/:\.//g;
 
 
                    $author{$rev_num[$rev_index]} = "\"" . $fields[2] .
"\"";
                    #
                    # remove leading : characters from the names which
cause problems in rcs
                    #
                    $author{$rev_num[$rev_index]}=~s/:\.//g;
                    print "Author: $author{$rev_num[$rev_index]}\n" if
($options{debug});
 
 
Looking at the source code of RCS I believe that you should strip Double
Quotes, COLON, SEMI-COLON and PERIODS out of the Author field before
allowing it to be put to RCS with the -w".
          
 
                    $author{$rev_num[$rev_index]}=~s/[":;\.]//g;
 
 
 
=====================================Problem 2 with solution
============================
 
This is the code from the RCS that checks for the identifier that is the
Author or -w option to rcs
 
 
 
/* character classes and token codes */
enum tokens {
/* classes */   DELIM,  DIGIT,  IDCHAR, NEWLN,  LETTER, Letter,
        PERIOD, SBEGIN, SPACE,  UNKN,
/* tokens */    COLON,  ID, NUM,    SEMI,   STRING
};
 
 
/* ISO 8859/1 (Latin-1) */
enum tokens const ctab[] = {
    UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,
    SPACE,  SPACE,  NEWLN,  SPACE,  SPACE,  SPACE,  UNKN,   UNKN,
    UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,
    UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,
    SPACE,  IDCHAR, IDCHAR, IDCHAR, DELIM,  IDCHAR, IDCHAR, IDCHAR,
/*                     !              "             #            $
%          &             '        */
    IDCHAR, IDCHAR, IDCHAR, IDCHAR, DELIM,  IDCHAR, PERIOD, IDCHAR,
/*        (            )             *               +            ,
-            .            /       */
    DIGIT,  DIGIT,  DIGIT,  DIGIT,  DIGIT,  DIGIT,  DIGIT,  DIGIT,
/*      0        1            2       3         4          5          6
7
    DIGIT,  DIGIT,  COLON,  SEMI,   IDCHAR, IDCHAR, IDCHAR, IDCHAR,
/*      8        9             :          ;             <             =
>            ?      */
    SBEGIN, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
/*        @          A           B            C            D
E          F            G  */
    LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
    LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
    LETTER, LETTER, LETTER, IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR,
/*        X            Y            Z           [              \
]            ^             _    */
    IDCHAR, Letter, Letter, Letter, Letter, Letter, Letter, Letter,
/*        `          a        b          c        d        e        f
g                            */
    Letter, Letter, Letter, Letter, Letter, Letter, Letter, Letter,
    Letter, Letter, Letter, Letter, Letter, Letter, Letter, Letter,
    Letter, Letter, Letter, IDCHAR, IDCHAR, IDCHAR, IDCHAR, UNKN,
    UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,
    UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,
    UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,
    UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,   UNKN,
    IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR,
    IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR,
    IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR,
    IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR, IDCHAR,
    LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
    LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
    LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, IDCHAR,
    LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, Letter,
    Letter, Letter, Letter, Letter, Letter, Letter, Letter, Letter,
    Letter, Letter, Letter, Letter, Letter, Letter, Letter, Letter,
    Letter, Letter, Letter, Letter, Letter, Letter, Letter, IDCHAR,
    Letter, Letter, Letter, Letter, Letter, Letter, Letter, Letter
};
 
 
>From  "rcslex.c"
 
 
 
checkidentifier(id, delimiter, dotok)
    register char *id;
    int delimiter;
    register int dotok;
/*   Function:  check whether the string starting at id is an   */
/*      identifier and return a pointer to the delimiter*/
/*      after the identifier.  White space, delim and 0 */
/*              are legal delimiters.  Aborts the program if not*/
/*              a legal identifier. Useful for checking commands*/
/*      If !delim, the only delimiter is 0.     */
/*      Allow '.' in identifier only if DOTOK is set.   */
{
        register char    *temp;
    register char c;
    register char delim = delimiter;
    int isid = false;
 
    temp = id;
    for (;;  id++) {
        switch (ctab[(unsigned char)(c = *id)]) {
            case IDCHAR:
            case LETTER:
            case Letter:
                isid = true;
                continue;
 
            case DIGIT:
                continue;
 
            case PERIOD:
                if (dotok)
                    continue;
                break;
 
            default:
                break;
        }
        break;
    }
    if (     ! isid
        ||   (c  &&  (!delim || (c!=delim && c!=' ' && c!='\t' &&
c!='\n')))
    ) {
                /* append \0 to end of id before error message */
        while ((c = *id) && c!=' ' && c!='\t' && c!='\n' && c!=delim)
            id++;
                *id = '\0';
        faterror("invalid %s `%s'",


reply via email to

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