Context:  Concurrent Versions System (CVS) 1.10.8 (client/server)
Platform: Red Hat Linux 6.1

This may be a bug or simply the result of unclear documentation, but I
unexpectedly found that cvs tried to use the wrong repository in the
following circumstances:

(Note, the development environment I use has two distinct source
 repositories containing disjoint sources.)

If cvs (in this case, "cvs diff foodir/foo.c") is run in an environment
where

a) the current working directory has no CVS directory defined (and
   therefore no CVS/Root), but ..

b) the target source file (foo.c) on which cvs is operating is in
   another directory (foodir) which DOES have a CVS directory defined,
   with the correct Root (CVS/Root) information defined, and ..

c) the CVSROOT environment variable specifies a different Root, and ..

d) -d option is NOT specified,

then cvs attempts to use the (incorrect) Root specified in $CVSROOT
and ignores the information in the CVS/Root file of the directory in
which the source resides.  

If CVSROOT is unset, 'cvs diff foodir/foo.c' reports "cvs diff: No
CVSROOT specified!"  etc., clearly indicating it is not finding the
foodir/CVS/Root file.

This seems to me to be a bug, since the online documentation states

(Quote) 'Once you've checked a working copy out from the repository,
it will remember where its repository is (the information is recorded
in the `CVS/Root' file in the working copy).

The -d option and the `CVS/Root' file both override the $CVSROOT
environment variable.'  (End quote)

While there are clearly a number of ways of avoiding this problem (get
CVSROOT right is favourite, or use -d), this is not always easy to
achieve or suitable as a long-term fix.  I stumbled on this while
using cvs diff inside a perl system() call; it turned out that the
shell initialisation files set CVSROOT to the 'wrong' value.  Yes, I
can fix that too for the immediate problem, but since I can't just
leave CVSROOT unset it's always going to be the wrong value on some
occasions.

David

[EMAIL PROTECTED]

Reply via email to