[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug in killing processes of user that contain multiple digits
From: |
Bas van der Vlies |
Subject: |
bug in killing processes of user that contain multiple digits |
Date: |
Tue, 11 Jul 2006 14:21:56 +0200 |
User-agent: |
Thunderbird 1.5.0.4 (X11/20060615) |
Hello,
we are using cfengine 2.1.20.
We kill all the processes of user when the job has finished on our
cluster. For some reasons not all processes are killed for some usernames.
example script:
#!/usr/sbin/cfagent -K -x -f
#
# This is the cfengine clean up script for cleaning up login
#
control:
actionsequence = ( processes )
processes:
".*"
signal=kill
action=do
filter=kill_users
filters:
{ kill_users
Owner: "root|postfix|daemon|ganglia|jaap|willem|bas|walter|bert|ramon"
Result: "!Owner"
}
I have patches process.c. The diff is included as patch.
Regards
--
--
********************************************************************
* *
* Bas van der Vlies e-mail: address@hidden *
* SARA - Academic Computing Services phone: +31 20 592 8012 *
* Kruislaan 415 fax: +31 20 6683167 *
* 1098 SJ Amsterdam *
* *
********************************************************************
--- process.c.org 2005-02-08 12:50:02.000000000 +0100
+++ process.c 2006-07-11 12:29:30.243631590 +0200
@@ -330,46 +330,34 @@
Debug("Matched proc[%s]\n",ip->name);
- one_space = false;
-
for (sp = ip->name; *sp != '\0'; sp++) /* if first field contains alpha,
skip */
{
while (true)
{
- while (!isdigit((int)*sp) && (*sp != '\0'))
- {
- if (*sp == ' ')
- {
- one_space = true;
- }
- sp++;
- }
-
- if (!one_space)
- {
- while(*sp != ' ' && *sp != '\t')
+ /* HvB If start with alpha then skip it till the first space */
+ if (isalnum((int)*sp))
+ {
+ while ((*sp != ' ') && (*sp != '\0'))
{
sp++;
- }
- }
-
- if ((sp > ip->name) && isalnum((int)*(sp-1))) /* Username contains
number*/
- {
- sp++;
- }
- else
- {
- break;
- }
- }
+ }
+ }
+
+ /* skip spaces and tabs */
+ while ((*sp == ' ') && (*sp == '\t'))
+ {
+ sp++;
+ }
+ break;
+ } /* end while */
sscanf(sp,"%d",&pid);
-
+
if (pid != -1)
{
break;
}
- }
+ } /* end for */
if (pid == -1)
{
- bug in killing processes of user that contain multiple digits,
Bas van der Vlies <=