This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

rcs 5.8-1 checks out wrong version of file when using similar mark symbols

Using rcs 5.8-1:

? ?Given two mark symbols, abc (version 1.1) and abcd (version 1.2),
? ?executing "co -rabc <file>" will check out version 1.2, when it
? ?should check out version 1.1.

I set the mark symbols as follows:
? ?rcs -nabc:1.1 -nabcd:1.2 <file>

I dug into it, and found the following (rcsrev.c):

01: ?static char const *
02: ?rev_from_symbol (struct cbuf const *id)
03: ?/* Look up "id" in the list of symbolic names starting with pointer
04: ? ? "GROK (symbols)", and return a pointer to the corresponding
05: ? ? revision number. ?Return NULL if not present. ?*/
06: ?{
07: ? ?for (struct link *ls = GROK (symbols); ls; ls = ls->next)
08: ? ? ?{
09: ? ? ? ?struct symdef const *d = ls->entry;
11: ? ? ? ?if (!strncmp (d->meaningful, id->string, id->size))
12: ? ? ? ? ?return d->underlying;
13: ? ? ?}
14: ? ?return NULL;
15: ?}

Note that line 11 tests the name of the requested mark symbol
(id->string) against each element of a linked-list (ls) containing all
the mark symbols for the file. ?The problem is that it will only test
the first 'id->size' characters - so R25 (from the command line) matches
R25a (from the list) because the first three characters match and it
won't test any more than that (strncmp).

I recommend modifying line 11 as follows:
? ?if ((strlen(d->meaningful) == strlen(id->size)) && !strncmp
(d->meaningful, id->string, id->size))

Of course, since you now know that the two strings are the same size,
you could use strcmp - but that assumes that the && short-circuits, and
I don't know if that's guaranteed.

I went through the cygcheck.out file and replaced my user, company,
printer and host names with 'username', 'companydomain', 'printername'
and 'hostname'. ?I also changed the UID and GID numbers.

Hope this is helpful,


Attachment: cygcheck.out
Description: Binary data

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]