Bug 1013483

Summary: XMLRPC and web search with same query yields different results
Product: [Community] Bugzilla Reporter: Alexander Todorov <atodorov>
Component: WebServiceAssignee: PnT DevOps Devs <hss-ied-bugs>
Status: CLOSED NOTABUG QA Contact: tools-bugs <tools-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 4.4CC: jmcdonal, rjoost
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-01 04:07:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Alexander Todorov 2013-09-30 08:10:00 UTC
Description of problem:

Filing here, although I'm not sure if this is strictly a bug or a feature. 

I have a script which uses python-bugzilla to run queries between two particular dates. When running from the script it gives 50 bugs, while when run manually from the webUI it yields 35. 

The query is:
classification=Red Hat&component=anaconda&component=parted&component=pykickstart&component=pyparted&f1=bug_status&f2=bug_status&f3=bug_status&list_id=1753757&o1=changedafter&o2=changedbefore&o3=changedto&product=Red Hat Enterprise Linux 5&query_format=advanced&v1=2013-01-08&v2=2013-10-01&v3=CLOSED


When run from a script some of the offending bugs are:
+750681
+754213

All they have in common is that they were closed by Errata Tool after release (5.9 GA), status changed from RELEASE_PENDING to CLOSED/ERRATA. 

Last closed: 2013-01-07 23:05:19 
When: 2013-01-08 06:05:19 EET 




I suspect that one of the searches uses UTC while the other uses local time values. If this is the case, how do I make the script query based on UTC values?

Comment 1 Alexander Todorov 2013-09-30 14:19:32 UTC
See comment #0 for the query string for the manual bug search. When using python-bugzilla I use this snippet:

qd = {
    'query_format' : 'advanced',
    'chfieldfrom' : datetime(2013, 1, 8, 00, 00, 00),
    'chfieldto' : datetime(2013, 10, 1, 23, 59, 59),
    'chfield' : 'bug_status',
    'chfieldvalue' : 'CLOSED',
    'product' : 'Red Hat Enterprise Linux 5',
    'component' : ['anaconda', 'pykickstart', 'parted', 'pyparted'],
}

bugs = bz.query(qd)

Comment 2 Jason McDonald 2013-10-01 04:07:16 UTC
Currently, it's a feature.

Bugzilla's Web UI does not adjust for the user's timezone and performs its searches using the server time (US/Eastern, UTC-4 during DST, UTC-5 the rest of the year).

If you want to query via the Web UI using UTC, you will need to include hours and minutes values to the query to convert UTC to server time (and adjust for DST).  For example, the query from comment #0 can be changed to:

https://bugzilla.redhat.com/buglist.cgi?classification=Red%20Hat&component=anaconda&component=parted&component=pykickstart&component=pyparted&f1=bug_status&f2=bug_status&f3=bug_status&list_id=1757947&o1=changedafter&o2=changedbefore&o3=changedto&product=Red%20Hat%20Enterprise%20Linux%205&query_format=advanced&v1=2013-01-07%2019%3A00&v2=2013-09-30%2020%3A00&v3=CLOSED

(Note the difference for applying DST to the second date but not the first.)

Note also that the search in comment #1 presumably used your local time (EET?) rather than UTC, so your script would also have to adjust for UTC to be guaranteed to produce the same set of search results.