Hi folks, (please reply directly to me, since I usually do not read this list)
I run into problems when using the pserver protocol the first time.
The server runs cvs-1.10.8, the client cvs-1.10.7
I did:
> cvs -d :pserver:cvstest@einstein:/home/cvstest/CVSROOT login
> cvs -d :pserver:cvstest@einstein:/home/cvstest/CVSROOT co test
> cd test
> cvs status Kernel/Makefile
and got the result:
Keine Berechtigung (german for: permission denied)
After one day of walking through mailing lists and the sources I found two
reasons for that strange, nothing telling message:
The code producing that message is from src/server.c:
status = create_adm_p (server_temp_dir, dir);
if (status != 0)
{
pending_error = save_errno;
if (alloc_pending (80 + strlen (dir_name)))
sprintf (pending_error_text, "E cannot create_adm_p %s", dir_name);
return;
}
alloc_pending() tests pending_error and returns TRUE if (pending_error!=0).
Thus pending_error_text is never set.
I replaced that by:
status = create_adm_p (server_temp_dir, dir);
if (status != 0)
{
int save_errno = errno;
if (alloc_pending (80 + strlen (dir_name)))
sprintf (pending_error_text, "E cannot create_adm_p %s", dir_name);
pending_error = save_errno;
return;
}
I did the same at all comparable locations in server.c . The patch is
appended.
When I now repeat the above command, I get the following message:
> cvs status Kernel/Makefile
cannot create_adm_p /tmp/cvs-serv9476/Kernel
Keine Berechtigung (german for: permission denied)
After going into the deeps of create_adm_p() I found that cvs did not find
CVSROOT/Emptydir and was not allowed to create it.
After running `cvs -d /home/cvstest/CVSROOT init' on the server as root,
the Emptydir was created and everything was ok:
> cvs status Kernel/Makefile
===================================================================
File: Makefile Status: Up-to-date
Working revision: 1.7
Repository revision: 1.7 /home/testcvs/CVSROOT/test/Kernel/Makefile,v
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: (none)
Ok: the reason for the missing Emptydir was, that I copied
/home/testcvs/CVSROOT from my normal CVSROOT, wondered about that strange
directory and removed it. I have to state, that my normal CVSROOT is not
owned by root but by me. Thus, cvs had no problems to create Emptydir when
it had to do it the other day.
Wouldn't it be a good idea to check for the existence of CVSROOT/Emptydir
and to report its nonexistence to the user and ask him to run cvs init as
root?
Regards,
Dietmar
diff -Naur server.c server.c.new
--- server.c Mon Nov 22 23:17:00 1999
+++ server.c.new Wed Jun 7 09:54:34 2000
@@ -738,7 +738,6 @@
{
char *env;
char *path;
- int save_errno;
char *arg_dup;
if (error_pending()) return;
@@ -806,7 +805,7 @@
(void) sprintf (path, "%s/%s", CVSroot_directory, CVSROOTADM);
if (!isaccessible (path, R_OK | X_OK))
{
- save_errno = errno;
+ int save_errno = errno;
pending_error_text = malloc (80 + strlen (path));
if (pending_error_text != NULL)
sprintf (pending_error_text, "E Cannot access %s", path);
@@ -816,7 +815,7 @@
(void) strcat (path, CVSROOTADM_HISTORY);
if (isfile (path) && !isaccessible (path, R_OK | W_OK))
{
- save_errno = errno;
+ int save_errno = errno;
pending_error_text = malloc (80 + strlen (path));
if (pending_error_text != NULL)
sprintf (pending_error_text, "E \
@@ -1036,9 +1035,10 @@
if (status != 0
&& status != EEXIST)
{
- pending_error = status;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (dir_name)))
sprintf (pending_error_text, "E cannot mkdir %s", dir_name);
+ pending_error = save_errno;
return;
}
@@ -1051,17 +1051,19 @@
status = create_adm_p (server_temp_dir, dir);
if (status != 0)
{
- pending_error = status;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (dir_name)))
sprintf (pending_error_text, "E cannot create_adm_p %s", dir_name);
+ pending_error = save_errno;
return;
}
if ( CVS_CHDIR (dir_name) < 0)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (dir_name)))
sprintf (pending_error_text, "E cannot change to %s", dir_name);
+ pending_error = save_errno;
return;
}
/*
@@ -1121,16 +1123,18 @@
f = CVS_FOPEN (CVSADM_ENT, "a");
if (f == NULL)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (CVSADM_ENT)))
sprintf (pending_error_text, "E cannot open %s", CVSADM_ENT);
+ pending_error = save_errno;
return;
}
if (fclose (f) == EOF)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (CVSADM_ENT)))
sprintf (pending_error_text, "E cannot close %s", CVSADM_ENT);
+ pending_error = save_errno;
return;
}
}
@@ -1199,16 +1203,18 @@
f = CVS_FOPEN (CVSADM_ENTSTAT, "w+");
if (f == NULL)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (CVSADM_ENTSTAT)))
sprintf (pending_error_text, "E cannot open %s", CVSADM_ENTSTAT);
+ pending_error = save_errno;
return;
}
if (fclose (f) == EOF)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (CVSADM_ENTSTAT)))
sprintf (pending_error_text, "E cannot close %s", CVSADM_ENTSTAT);
+ pending_error = save_errno;
return;
}
}
@@ -1224,23 +1230,26 @@
f = CVS_FOPEN (CVSADM_TAG, "w+");
if (f == NULL)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (CVSADM_TAG)))
sprintf (pending_error_text, "E cannot open %s", CVSADM_TAG);
+ pending_error = save_errno;
return;
}
if (fprintf (f, "%s\n", arg) < 0)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (CVSADM_TAG)))
sprintf (pending_error_text, "E cannot write to %s", CVSADM_TAG);
+ pending_error = save_errno;
return;
}
if (fclose (f) == EOF)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (CVSADM_TAG)))
sprintf (pending_error_text, "E cannot close %s", CVSADM_TAG);
+ pending_error = save_errno;
return;
}
}
@@ -1563,9 +1572,10 @@
t.modtime = t.actime = checkin_time;
if (utime (arg, &t) < 0)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (arg)))
sprintf (pending_error_text, "E cannot utime %s", arg);
+ pending_error = save_errno;
return;
}
checkin_time_valid = 0;
@@ -1852,9 +1862,10 @@
f = CVS_FOPEN (CVSADM_ENT, "a");
if (f == NULL)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (CVSADM_ENT)))
sprintf (pending_error_text, "E cannot open %s", CVSADM_ENT);
+ pending_error = save_errno;
}
}
for (p = entries; p != NULL;)
@@ -1863,10 +1874,11 @@
{
if (fprintf (f, "%s\n", p->entry) < 0)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen(CVSADM_ENT)))
sprintf (pending_error_text,
"E cannot write to %s", CVSADM_ENT);
+ pending_error = save_errno;
}
}
free (p->entry);
@@ -1877,9 +1889,10 @@
entries = NULL;
if (f != NULL && fclose (f) == EOF && !error_pending ())
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (CVSADM_ENT)))
sprintf (pending_error_text, "E cannot close %s", CVSADM_ENT);
+ pending_error = save_errno;
}
}
@@ -4460,24 +4473,27 @@
f = CVS_FOPEN (CVSADM_CIPROG, "w+");
if (f == NULL)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (CVSADM_CIPROG)))
sprintf (pending_error_text, "E cannot open %s", CVSADM_CIPROG);
+ pending_error = save_errno;
return;
}
if (fprintf (f, "%s\n", arg) < 0)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (CVSADM_CIPROG)))
sprintf (pending_error_text,
"E cannot write to %s", CVSADM_CIPROG);
+ pending_error = save_errno;
return;
}
if (fclose (f) == EOF)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (CVSADM_CIPROG)))
sprintf (pending_error_text, "E cannot close %s", CVSADM_CIPROG);
+ pending_error = save_errno;
return;
}
}
@@ -4503,23 +4519,26 @@
f = CVS_FOPEN (CVSADM_UPROG, "w+");
if (f == NULL)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (CVSADM_UPROG)))
sprintf (pending_error_text, "E cannot open %s", CVSADM_UPROG);
+ pending_error = save_errno;
return;
}
if (fprintf (f, "%s\n", arg) < 0)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (CVSADM_UPROG)))
sprintf (pending_error_text, "E cannot write to %s", CVSADM_UPROG);
+ pending_error = save_errno;
return;
}
if (fclose (f) == EOF)
{
- pending_error = errno;
+ int save_errno = errno;
if (alloc_pending (80 + strlen (CVSADM_UPROG)))
sprintf (pending_error_text, "E cannot close %s", CVSADM_UPROG);
+ pending_error = save_errno;
return;
}
}
@@ -4907,10 +4926,11 @@
status = mkdir_p (server_temp_dir);
if (status != 0 && status != EEXIST)
{
+ int save_errno = errno;
if (alloc_pending (80))
strcpy (pending_error_text,
"E can't create temporary directory");
- pending_error = status;
+ pending_error = save_errno;
}
#ifndef CHMOD_BROKEN
else
--
---------------------------------------------------------------------------
Dr. Dietmar Petras Senior Expert
ELSA AG Engineering Consumer Communications
Sonnenweg 11 Phone: +49-(0)241-606-4649
52070 Aachen Fax: +49-(0)241-606-4699
Germany EMail: [EMAIL PROTECTED]
---------------------------------------------------------------------------