Subject: Re: kernel filesystem code move
To: None <cgd@broadcom.com>
From: Bill Squier <groo@old-ones.com>
List: tech-kern
Date: 01/06/2003 18:05:51
On Sun, Jan 05, 2003 at 01:45:12PM -0800, cgd@broadcom.com wrote:
> > FWIW why does no one (except me) ever increment the first number?
> 
> I seem to recall seeing statements and explanations on the 'net about
> that causing problems.  I don't recall anything about the details though.

Here's one reason:

-----------:

Most normal usage of CVS would never encounter this, but in case it does bite
you some day, I thought it might be worth mentioning here (plus several
people on ICB were curious).

Where I work some developers had at one point used "cvs commit -r<rev>" to
bump the major revision of some files.  At some point, those same files were
cvs remove'd.  Still later, they attempted to add files with the same
name to those directories.

Normally, this is okay, and CVS assigns the next revision to the new file 
(bringing the old ,v out of the Attic).  However, in the face of the  
major revision bump, things go wrong.  Here's an example you all can 
try: 
 
  

----
        
# sh -x ~/tmp/r
+ echo test
+ cvs add revprob
cvs add: scheduling file `revprob' for addition
cvs add: use 'cvs commit' to add this file permanently
+ cvs commit -m add revprob
RCS file: /home/groo/cvsroot/foobaz/revprob,v
done
Checking in revprob;
/home/groo/cvsroot/foobaz/revprob,v  <--  revprob
initial revision: 1.1
done
+ rm revprob
+ cvs remove revprob
cvs remove: scheduling `revprob' for removal
cvs remove: use 'cvs commit' to remove this file permanently
+ cvs commit -m removed revprob
Removing revprob;
/home/groo/cvsroot/foobaz/revprob,v  <--  revprob
new revision: delete; previous revision: 1.1
done
+ echo test2
+ cvs add revprob
cvs add: re-adding file revprob (in place of dead revision 1.2)
cvs add: use 'cvs commit' to add this file permanently
+ cvs commit -m add2 -r2.0 revprob
Checking in revprob;
/home/groo/cvsroot/foobaz/revprob,v  <--  revprob
new revision: 2.0; previous revision: 1.2
done
+ cvs update -PAd revprob
+ echo test2.1
+ cvs commit -m rev2.1 revprob
Checking in revprob;
/home/groo/cvsroot/foobaz/revprob,v  <--  revprob
new revision: 2.1; previous revision: 2.0
done
+ rm revprob
+ cvs remove revprob
cvs remove: scheduling `revprob' for removal
cvs remove: use 'cvs commit' to remove this file permanently
+ cvs commit -m removed2 revprob
Removing revprob;
/home/groo/cvsroot/foobaz/revprob,v  <--  revprob
new revision: delete; previous revision: 2.1
done
+ echo test3
+ cvs add revprob
cvs add: re-adding file revprob (in place of dead revision 2.2)
cvs add: use 'cvs commit' to add this file permanently
+ cvs commit -m new3 revprob
Checking in revprob;
/home/groo/cvsroot/foobaz/revprob,v  <--  revprob
cvs commit: /home/groo/cvsroot/foobaz/revprob,v: revision 1.1 too low; must be  
+higher than 2.2
cvs commit: could not check in revprob

----


The workaround is to just "-r<the_next_rev>" in that last commit.  Here,
-r2.3 would be appropriate.

Even though CVS fails to
check in a new revision of "revprob" it *still brings revprob,v out of the
Attic*!  This, of course, causes CVS to fail to do any commits to that
file, since the head revision is marked dead.  It has to be manually moved
back into the Attic on the repository.

-----------

-- 
Bill Squier (groo@old-ones.com)                          http://www.netbsd.org

        I know I don't deserve another chance, but this _is_ America,
        and as an American, aren't I entitled to one?  --Sideshow Bob.