bug-cfengine
[Top][All Lists]
Advanced

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

[Patch] Bug in ParseTTime() from filters.c


From: bobb
Subject: [Patch] Bug in ParseTTime() from filters.c
Date: Thu, 24 Jun 2004 19:18:48 +0100
User-agent: Mutt/1.4.1i

I have discoverd a bug in ParseTTime() in filters.c when parsing an 
accumulated()
Total Time in the form min:sec.

Running debian sarge, cfengine-2.0.9+2.1.0b5-1, however I have confirmed
that it also exists in cfengine-2.1.6.

A simple processes filter that searches for accumulated time over 5 days 
shows the following after running for 46 minutes 48 seconds...


        Regex bobb     19230 99.9  0.2  6600 5468 ?        R    11:52  46:48 
./greedy matched .
        [...]
        ParseTTime = accumulated(0,0,46,46,46,48)
        Matched proc[bobb     19230 99.9  0.2  6600 5468 ?        R    11:52  
46:48 ./greedy]


Accumulated time is returned as 46 days, 46 hours, 46 minutes and 48 seconds.

When the time has gone above 1 hour, ParseTTime() starts returning sensible
values...

        Regex bobb     19230 27.7  0.2  6600 5468 ?        T    11:52 119:48 
./greedy matched .
        [...]
        ParseTTime = accumulated(0,0,0,1,59,48)
        bobb     19230 27.7  0.2  6600 5468 ?        T    11:52 119:48 ./greedy 
Filtered away

Seems that the preceding sscanf()'s populate the day and hour variables
in turn, with the value of the minute from ps.

I'm not sure what the correct way to fix this is, but simply removing
the if() test as shown in the attached patch (against 2.1.6),
ensures the day and hour values are reset to zero.

Cheers,

- bobb

-- 
Bob B. Crosbie.
Trinity Centre for High Performance Computing,
O'Reilly Institute, Trinity College Dublin.
Tel: +353 1 608 3725

Attachment: filters.c.patch
Description: Text document


reply via email to

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