Package: cvs
Version: 1:1.12.9-11
Severity: normal

Short steps to reproduce:

  rm foo.c; cvs rm foo.c   (for some existing file foo.c in CVS)
  cvs -t diff -r BASE -r HEAD foo.c

(Longer steps, starting from cvs init, given below.)

The `cvs rm' should negate the version number of foo.c in CVS/Entries,
which is queried for `-r BASE'.

Then RCS_checkout is passed a negative revision number, and the
assert (rev == NULL || isdigit (*rev)) assertion fails.

Appended is a patch that addresses one side of the problem: this patch
fixes the problem if the server has this patch applied (whether or not the
client cvs is patched), but this patch change the client not to send
"bad" data over the wire to begin with; so if the client has the
appended patch applied but the server doesn't, then the assertion will
still fire (on the unpatched server cvs).

I've tested the patch by creating a local repository, and checking that
cvs 1:1.12.9-10 causes the failed assertion and that the patched version
doesn't fail.  Session extract follows (with some commands' output
omitted):

  $ mkdir /tmp/frog
  $ cvs -d /tmp/frog init
  $ mkdir /tmp/bull
  $ cd /tmp/bull
  $ cvs -d /tmp/frog import -m '' hello acme empty
  $ cvs -d /tmp/frog co hello
  $ cd hello
  $ (echo '#include <stdio.h>';echo 'int main(void) { printf("hi\n"); }') > 
hello.c
  $ cvs add -ko hello.c
  $ cvs commit -m new hello.c
  $ rm hello.c ;cvs rm hello.c
  $ cvs diff -r BASE -r HEAD hello.c
  cvs: rcs.c:4003: RCS_checkout: Assertion `rev == ((void *)0) || 
((*__ctype_b_loc ())[(int) (((unsigned char) *rev))] & (unsigned short int) 
_ISdigit)' failed.
  cvs [diff aborted]: received abort signal
  $ ~/build/cvs/cvs-1.12.9/build-tree/cvs-1.12.9/src/cvs diff -r BASE -r HEAD 
hello.c
  $

The appended patch assumes that it is to be applied after all existing
rcs.c patches, i.e. after 63_add_commit_dir.

pjrm.

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.8-2-k7
Locale: LANG=C, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)

Versions of packages cvs depends on:
ii  debconf                     1.4.30.11    Debian configuration management sy
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an
ii  libpam-runtime              0.76-22      Runtime support for the PAM librar
ii  libpam0g                    0.76-22      Pluggable Authentication Modules l
ii  zlib1g                      1:1.2.2-3    compression library - runtime

-- debconf information excluded

diff -ruN cvs-1.12.9-old/src/rcs.c cvs-1.12.9/src/rcs.c
--- cvs-1.12.9-old/src/rcs.c    2005-03-01 10:59:48.000000000 +1100
+++ cvs-1.12.9/src/rcs.c        2005-03-01 21:41:08.000000000 +1100
@@ -4000,6 +4000,9 @@
                  : (sout != RUN_TTY ? sout
                      : "(stdout)" ) ) ) );
 
+    if (rev && *rev == '-')
+       ++rev;
+
     assert (rev == NULL || isdigit ((unsigned char) *rev));
 
     if (noexec && workfile != NULL)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to