info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS_USER ... again


From: Dave Morrison
Subject: CVS_USER ... again
Date: Sat, 14 Apr 2001 19:14:24 -0400
User-agent: Mozilla/5.0 (X11; U; Linux 2.2.19pre7 i686; en-US; 0.8.1) Gecko/20010412

Hi,

I read with great interest the thread "CVS_USER" that started with this
message back in October, 2000:

http://groups.yahoo.com/group/info-cvs/message/25499

I've never been able to override CVS' insistence on using the login name
when writing to the history file.  There seem to be a lot of people
interested in the topic, but CVS still doesn't do as its documentation
claims.  Derek Price's patch looks interesting, but as far as can tell,
it hasn't been applied to the current sources. In lieu of that patch,
could I suggest a much simpler patch that does nothing more than get CVS
to use the CVS_USER environment variable, if it's defined, in place of
the login name.  It's a small patch, and it may be made redundant by
better and bigger patches, but it does do something useful.  I've
applied it against my local installation and I've tested it for a bit. It works for me.

Cheers,
Dave

Index: src/subr.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/subr.c,v
retrieving revision 1.69
diff -u -r1.69 subr.c
--- src/subr.c  2001/03/15 14:03:14     1.69
+++ src/subr.c  2001/04/14 22:27:22
@@ -335,6 +335,7 @@
     struct passwd *pw;
     uid_t uid;
 #endif
+    char *name;

     /* If there is a CVS username, return it.  */
 #ifdef AUTH_SERVER_SUPPORT
@@ -355,8 +356,6 @@
     uid = getuid ();
     if (uid == (uid_t) 0)
     {
- char *name;
-
        /* super-user; try getlogin() to distinguish */
        if (((name = getlogin ()) || (name = getenv("LOGNAME")) ||
             (name = getenv("USER"))) && *name)
@@ -365,6 +364,11 @@
            return cache;
        }
     }
+    if ((name = getenv("CVS_USER")) && *name)
+    {
+        cache = xstrdup (name);
+ return cache;
+    }
     if ((pw = (struct passwd *) getpwuid (uid)) == NULL)
     {
        char uidname[20];
@@ -372,7 +376,7 @@
        (void) sprintf (uidname, "uid%lu", (unsigned long) uid);
        cache = xstrdup (uidname);
        return cache;
-    }
+    }
     cache = xstrdup (pw->pw_name);
     return cache;
 #endif

--
David Morrison  Brookhaven National Laboratory  phone: 631-344-5840
                Physics Department, Bldg 510 C    fax: 631-344-3253
                          Upton, NY 11973-5000  email: address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]