Wednesday, January 28, 2009

Errors while committing files to CVS #cvs.history.lock

I get the following error while committing new file to cvs.

RCS file: /module_repo/dev/devdocs/studydocs/mydoc_HLD.doc,v
done
Checking in mydoc_HLD.doc;
/module_repo/dev/devdocs/studydocs/mydoc_HLD.doc.doc,v <-- mydoc_HLD.doc
initial revision: 1.1
done
cvs commit: failed to create lock directory for `/module/CVSROOT' (/module_repo/CVSROOT/#cvs.history.lock): Permission denied
cvs commit: failed to obtain history lock in repository `/module_repo'


Reason:
Means, lock files used by CVS for synchronization of commits, could not be created due to lack of permissions in repository

Analysis:
file name : CVSROOT\config
"LockDir" is not set in this file
In fact it is commented as "/var/lock/cvs". We need to uncomment it by removing "#".

Solution:
[Pre-requisite:: You should be root/administrative user. This should be done on (linux/unix) system where CVS is set up.]

1. Go to "/CVSROOT

2. Un-comment this line in CVSROOT/config
>> Line with "LockDir"
This enables "lock file" to be created in /var/lock/cvs instead of "repository", which is what should be the result.

3. Now create a new directory "/var/lock/cvs" as root.

4. Change the group ownership using "chgrp"
Example : chgrp "mygroup" cvs

5. Also change the ownership of the group to "mygroup"
chown :mygroup cvs

6. Now give "write" permissions to all users in "mygroup"
chmod g+w cvs


This will avoid the error we got earlier which code commit..