Bug 730350

Summary: rewrite rhnsd to use difftime
Product: Red Hat Enterprise Linux 6 Reporter: Tomas Lestach <tlestach>
Component: rhnsdAssignee: Tomas Lestach <tlestach>
Status: CLOSED WONTFIX QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: jpazdziora, jwest, mminar
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-09 09:05:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomas Lestach 2011-08-12 14:51:31 UTC
Description of problem:
In rhnsd an integer/float will be added to time_t, what is not recommended.
Instead of that difftime shall be used - in the way we do not add amount of seconds to time_t, but to go the other way around - to make a difference of two times in time_t

double difftime ( time_t time2, time_t time1 );
 Return difference between two times
 Calculates the difference in seconds between time1 and time2.
Parameters
 time2 - time_t object representing the latter of the two times.
 time1 - time_t object representing the earlier of the two times.
Return Value
 The difference in seconds (time2-time1) as a floating point double.


Version-Release number of selected component (if applicable):
rhnsd-4.9.3-3


Using
time_t + float(int)
isn't strictly defined and may cause troubles mainly in the future, when internal representation of time_t changes

difftime() is recommended for time differences and shall always return time difference in seconds (also in the future)

Comment 1 Jan Pazdziora 2011-11-23 16:07:11 UTC
Tomas, the comment 0 is fairly confusing. Could you please amend the bugzilla with Actual results and Expected results, so that we have something to work wich while acking the proposed change, not mentioning the fact that QA will want this to make a test plan (should we ever decide some change is called for)?

Your cooperation in this matter would be greatly appreciated.

Comment 2 Tomas Lestach 2011-11-24 09:43:12 UTC
As already discussed with Simon, there's no real test plan available.
Everything we can do is to:
# grep difftime client/rhel/rhnsd/rhnsd.c

Adding float to time_t doesn't return correct values, however the deviation is that small (lowest rhnsd interval is 1 hour) that it's not really possible for QA to detect the difference between the correct behavior and misbehavior.

This BZ doesn't address any visible misbehavior, it addresses the concept and usage of adding and comparing of date structures.

Comment 3 Jan Pazdziora 2011-11-24 10:33:01 UTC
Thank you, Tomáš. Setting devel ack then. Let's leave it on QA to decide if they'd be able to QA the change at all.

Comment 5 RHEL Program Management 2011-12-09 09:05:44 UTC
Quality Engineering Management has reviewed and declined this request.  You may
appeal this decision by reopening this request.