First, sorry for the wrong diff type it will be corrected in the future.
Second, I have read the manual and many of the related posts on this list and this seems to be a real problem even if it is only on linux. The solution proposed in the manual, while it seems to work, seems to me to be a bit of a kludge.
The question the I keep asking myself is why should the server be opening those files to begin with? cvsignore and cvswrappers for the server live in CVSROOT and what it was doing for history seems to be just a hack to get the full path for HOME. The server process has no business trying to open the user files for root. Along with possible security issues, could this also cause some unexpected results depending on the contents of the cvs user files in ~root?
Granted CVS was dependent on some specific behavior of inetd on linux and it was inetd that changed but software should be robust enough to handle these kinds of changes. I admit I don't know the source very well nor the reasoning behind alot of the design but IMHO this is a problem that should be addressed by the CVS software and not some trick in setting it up. I'm just offering what I feel is a cleaner solution.
My $.02
Tony Cleveland
Context diff at end that also patches cvsrc.c to eliminate need for -f option in server mode. Do what you will with it.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 28, 2000 5:11 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: "can't chdir(/root)" error
Tony Cleveland writes:
>
> Attached is a patch to CVS 1.10.8 to fix the "can't chdir(/root)" error on
> Redhat linux 6.1. From what I read this is caused by inetd daemon not
> starting with a clean environment and CVS trying to open files in the root
> user's directory for which it doesn't not have permissions. The patches to
> ignore.c and wrapper.c came from a post in the egroups archive(I don't
> remember the author, sorry). A similar patch was needed in history.c to
> completely fix the problem. We have been running this for about a month and
> it appears to working ok.
Please note that "plain" diffs are almost completely useless, you should
always send context diffs or unified diffs instead. In this particular
case, however, don't bother -- the current version of CVS (1.10.8) has
advice for dealing with this problem in the manual, and we don't believe
that any changes to the CVS code are desirable. (Linux is definitely
the only system exhibiting this problem, so perhaps changes to Linux are
indicated instead.)
-Larry Jones
The hardest part for us avant-garde post-modern artists is
deciding whether or not to embrace commercialism. -- Calvin
? root_perm.diff
Index: cvsrc.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/cvsrc.c,v
retrieving revision 1.20
diff -c -r1.20 cvsrc.c
*** cvsrc.c 1998/12/23 15:15:00 1.20
--- cvsrc.c 2000/02/29 15:51:33
***************
*** 32,38 ****
char ***argv;
char *cmdname;
{
! char *homedir;
char *homeinit;
FILE *cvsrcfile;
--- 32,38 ----
char ***argv;
char *cmdname;
{
! char *homedir = NULL;
char *homeinit;
FILE *cvsrcfile;
***************
*** 64,75 ****
/* determine filename for ~/.cvsrc */
! homedir = get_homedir ();
/* If we can't find a home directory, ignore ~/.cvsrc. This may
make tracking down problems a bit of a pain, but on the other
hand it might be obnoxious to complain when CVS will function
just fine without .cvsrc (and many users won't even know what
.cvsrc is). */
if (!homedir)
return;
--- 64,82 ----
/* determine filename for ~/.cvsrc */
! #ifdef SERVER_SUPPORT
! if (!server_active)
! /* Don't try to use a ~/.cvsrc file in server mode. */
! #endif
! {
! homedir = get_homedir ();
/* If we can't find a home directory, ignore ~/.cvsrc. This may
make tracking down problems a bit of a pain, but on the other
hand it might be obnoxious to complain when CVS will function
just fine without .cvsrc (and many users won't even know what
.cvsrc is). */
+ }
+
if (!homedir)
return;
Index: history.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/history.c,v
retrieving revision 1.47
diff -c -r1.47 history.c
*** history.c 1999/12/30 04:05:35 1.47
--- history.c 2000/02/29 15:51:33
***************
*** 736,744 ****
if (!PrCurDir)
{
! char *pwdir;
pwdir = get_homedir ();
PrCurDir = CurDir;
if (pwdir != NULL)
{
--- 736,750 ----
if (!PrCurDir)
{
! char *pwdir = NULL;
+ #ifdef SERVER_SUPPORT
+ if (!server_active)
+ #endif
+ {
pwdir = get_homedir ();
+ }
+
PrCurDir = CurDir;
if (pwdir != NULL)
{
Index: ignore.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/ignore.c,v
retrieving revision 1.32
diff -c -r1.32 ignore.c
*** ignore.c 1999/12/30 03:08:26 1.32
--- ignore.c 2000/02/29 15:51:33
***************
*** 53,59 ****
void
ign_setup ()
{
! char *home_dir;
char *tmp;
ign_inhibit_server = 0;
--- 53,59 ----
void
ign_setup ()
{
! char *home_dir = NULL;
char *tmp;
ign_inhibit_server = 0;
***************
*** 80,92 ****
free (file);
}
! /* Then add entries found in home dir, (if user has one) and file exists */
home_dir = get_homedir ();
/* If we can't find a home directory, ignore ~/.cvsignore. This may
make tracking down problems a bit of a pain, but on the other
hand it might be obnoxious to complain when CVS will function
just fine without .cvsignore (and many users won't even know what
.cvsignore is). */
if (home_dir)
{
char *file = xmalloc (strlen (home_dir) + sizeof (CVSDOTIGNORE) + 10);
--- 80,99 ----
free (file);
}
! #ifdef SERVER_SUPPORT
! if (!server_active)
! /* Don't try to use a ~/.cvsignore file in server mode. */
! #endif
! {
! /* Then add entries found in home dir, (if user has one) and file exists */
home_dir = get_homedir ();
/* If we can't find a home directory, ignore ~/.cvsignore. This may
make tracking down problems a bit of a pain, but on the other
hand it might be obnoxious to complain when CVS will function
just fine without .cvsignore (and many users won't even know what
.cvsignore is). */
+ }
+
if (home_dir)
{
char *file = xmalloc (strlen (home_dir) + sizeof (CVSDOTIGNORE) + 10);
Index: wrapper.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/wrapper.c,v
retrieving revision 1.26
diff -c -r1.26 wrapper.c
*** wrapper.c 1998/12/23 15:15:01 1.26
--- wrapper.c 2000/02/29 15:51:33
***************
*** 88,94 ****
move this to a per-connection data structure, or better yet
think about a cleaner solution. */
static int wrap_setup_already_done = 0;
! char *homedir;
if (wrap_setup_already_done != 0)
return;
--- 88,94 ----
move this to a per-connection data structure, or better yet
think about a cleaner solution. */
static int wrap_setup_already_done = 0;
! char *homedir = NULL;
if (wrap_setup_already_done != 0)
return;
***************
*** 115,120 ****
--- 115,124 ----
free (file);
}
+ #ifdef SERVER_SUPPORT
+ if (!server_active)
+ #endif
+ {
/* Then add entries found in home dir, (if user has one) and file
exists. */
homedir = get_homedir ();
***************
*** 123,128 ****
--- 127,134 ----
hand it might be obnoxious to complain when CVS will function
just fine without .cvswrappers (and many users won't even know what
.cvswrappers is). */
+ }
+
if (homedir != NULL)
{
char *file;