[Top][All Lists]

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

Re: adding a new CVS_PID environment variable

From: Derek Robert Price
Subject: Re: adding a new CVS_PID environment variable
Date: Fri, 07 Mar 2003 18:18:21 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02

Mark D. Baushke wrote:

Derek Robert Price <address@hidden> writes:
Mark D. Baushke wrote:
Hi Folks,

The FreeBSD folks have had a CVS_PID environment variable in their
version of cvs since 1997-05-15 and they got it from the OpenBSD folks
before that. It is a simple addition. Here is my port of this feature.
Can you provide some examples why is would be useful to have the PID
of the parent process?

Doing something like log_accum in an environment to collect all of the
changes for a given commit into a single e-mail message and send it, but
NOT using perl might be one reason.

The place where I saw this used was when there were multiple levels of
shell scripts being used for the commitinfo/verifymsg/loginfo triggers
and they wanted to use the log_accum trick of being able to find
intermediate results between those triggers.

Consider a trigger that does something like this:

DEFAULT $CVSROOT/CVSROOT/path-to-some-command

where path-to-some-command does

 -> run a check to see if the user is administratively allowed to
    commit or not (possibly checking for a valid
 -> run a child-script
    -> runs a script to checks for the copyright being up-to-date
    -> runs a script to check the code has been run thru ident
    -> runs something like the commit_prep example where child-script
       rather than the 'cvs' process is really the parent

If the ${CVS_PID} variable is available, then there is less need to be
worried about some check in a child script scribbling information into a
file that a subsequent log_accum equivalent script will eventually find.

In this example, a single ps -eaf |grep type check and setting of the CVS_PID env variable would serve just as well.

The c "getppid" function is defined by POSIX, BSD 4.3, and SVID to
return the PID of the parent process.  Isn't there some shell

I do not know of any for the various shells that exist. However, even if
there was a way to find the partent of the current script, that does not
imply that it is the cvs parent.

Also, there is nothing to guarentee that the script fired off by the
commitinfo/verifymsg/loginfo trigger.

Huh?  This last sentence is confusing.

At the least, something like `ps -eaf |grep $$' should be
usable.  What's the point of including this in the CVS code?

Yes, there are possibilities that exist for many operating systems to
let you try to figure out which cvs process is the root of your current

They are not very portable as solutions go (try to figure out cleaner
tests than the ones I wrote for sanity.sh and then get it running on the
same number of targets hosts for which cvs may be compiled). Then try to
figure out how much extra processing would end up getting done by each
of the trigger scripts to communicate in that way.

A single ps -eaf |grep per script call, so once per directory. It's one thing if the scripts can't get the information somewhere else, but CVS does the extra processing even when the variable isn't being used if the change gets made.

A final point, I would consider it useful if the divergent versions of
CVS that exist could somehow make it back together (when you have a
heterogeneous computing environment it is nice to use the same tools
across all f your machines if possible). This is a small feature that
seems to be useful to the FreeBSD cvs community. Why not make it
available to the cvshome.org community as well?

Thanks for your consideration of this patch.

I see this point, but if the workaround is simple enough, I'd rather convince the BSD folks to use it and lose their hack.



Email: address@hidden

Get CVS support at <http://ximbiot.com>!
Of liberty I would say that, in the whole plenitude of its extent, it is
unobstructed action according to our will.  But rightful liberty is
unobstructed action according to our will within limits drawn around us by the
equal rights of others.  I do not add 'within the limits of the law,' because
law is often but the tyrant's will, and always so when it violates the right of
an individual.
                        - Thomas Jefferson to I. Tiffany, 1819.

reply via email to

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