Gilbert Ramirez <gram@xxxxxxxxxx> wrote:
> By default, 'cvs update' doesn't add new directories. I don't know if this
> is a result of its being based on RCS, which is directory oriented or not.
> All I know is that I don't like the default behavior. Whenever a directory
> is added to the CVS repository, two things need to happen:
>
> 1. The group of the new directory on cvs.ethereal.com needs to change
> to 'cvs'. CVS doesn't do this automatically, and it would be awkward
> for our default group on cvs.ethereal.com to be cvs, causing any file
> that we create on that computer be owned by group 'cvs'.
We solved this problem by using the SGID bit in CVS repository
directories.
% uname
Linux
% id
uid=8129(hessu) gid=8129(hessu) groups=8129(hessu),4(adm),33(www-data),103(wizards),105(cvs),106(bb)
% umask
002
% cd /disk/cvs
% ls -la
total 48
drwxrwsr-x 12 root cvs 4096 Nov 8 17:44 .
drwxr-xr-x 5 root root 4096 Apr 4 2000 ..
drwxrwsr-x 3 root cvs 4096 Nov 8 17:46 CVSROOT
drwxrwsr-x 11 hessu bb 4096 Nov 22 13:32 bb
drwxrwsr-x 6 juzi cvs 4096 Nov 7 17:11 http
[cut]
% ls -l bb
total 56
drwxrwsr-x 2 hessu bb 4096 Nov 13 01:57 Attic
-r--r--r-- 1 hessu bb 1264 Nov 20 04:30 Makefile.am,v
-r--r--r-- 1 majis bb 840 Apr 5 2000 README,v
-r-xr-xr-x 1 hessu bb 886 Nov 20 04:40 bootstrap.sh,v
drwxrwsr-x 2 hessu bb 4096 Nov 22 13:32 config
-r--r--r-- 1 juzi bb 4577 Nov 21 08:51 configure.in,v
drwxrwsr-x 6 hessu bb 4096 Nov 22 13:32 cops
[cut]
The solaris "man -s2 chmod" describes the SGID bit for directories
quite well:
If a directory has the set group ID bit set, a given file
created within that directory will have the same group ID as
the directory, if that group ID is part of the group ID set
of the process that created the file. Otherwise, the newly
created file's group ID will be set to the effective group
ID of the creating process.
The umask ensures that the directories will become group writeable
and every CVS user belongs to at least group cvs. We later refined
this to create a group per project so that e.g. not every person
in group cvs also belongs to group bb.
> If the directory's group is not changed, then no one besides the owner of
> the file can retrieve it (cvs update, cvs checkout) via cvs.
The setup above should handle this.
> 2. Everyone's local CVS image needs to be updated via 'cvs update -d' to
> get the new directory.
Or then you can use your .cvsrc to handle this. Of course, this is
only useful if you already knew about the -d option.
% cat $HOME/.cvsrc
checkout -P
update -P -d
diff -u
Heikki