Bug 1044453

Summary: [abrt] glib2-devel: gtester-report:244:handle_info:KeyError: 'package'
Product: [Fedora] Fedora Reporter: Iago Rubio <iago>
Component: glib2Assignee: Matthias Clasen <mclasen>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: iago, mclasen, philip
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/5126765d9e20ed72b310ce5404c79c69f362f604
Whiteboard: abrt_hash:f29dafbd6ac9969db224693a24fe2b03f37ed392
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-17 19:42:15 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:
Attachments:
Description Flags
File: backtrace
none
File: environ
none
File: Screencast from 18-12-13 11:46:14.webm
none
File: triggerbug.tar.gz
none
Proposed patch to add default values to the missing fields in the XML report none

Description Iago Rubio 2013-12-18 10:51:37 UTC
Description of problem:
gtester-report raised a exception after trying to parse a simple test results file generated by a simple glib test.


Version-Release number of selected component:
glib2-devel-2.36.3-4.fc19

Additional info:
reporter:       libreport-2.1.10
cmdline:        /usr/bin/python /bin/gtester-report testresults.xml
executable:     /bin/gtester-report
kernel:         3.11.10-200.fc19.x86_64
runlevel:       N 3
type:           Python
uid:            1000

Truncated backtrace:
gtester-report:244:handle_info:KeyError: 'package'

Traceback (most recent call last):
  File "/bin/gtester-report", line 492, in <module>
    main()
  File "/bin/gtester-report", line 486, in main
    HTMLReportWriter(rr.get_info(), rr.binary_list()).printout()
  File "/bin/gtester-report", line 350, in printout
    self.handle_info ()
  File "/bin/gtester-report", line 244, in handle_info
    self.oprint ('<h3>Package: %(package)s, version: %(version)s</h3>\n' % self.info)
KeyError: 'package'

Local variables in innermost frame:
self: <__main__.HTMLReportWriter object at 0x1485890>

Potential duplicate: bug 712731

Comment 1 Iago Rubio 2013-12-18 10:51:42 UTC
Created attachment 838233 [details]
File: backtrace

Comment 2 Iago Rubio 2013-12-18 10:51:45 UTC
Created attachment 838234 [details]
File: environ

Comment 3 Iago Rubio 2013-12-18 10:51:49 UTC
Created attachment 838235 [details]
File: Screencast from 18-12-13 11:46:14.webm

Comment 4 Iago Rubio 2013-12-18 10:51:52 UTC
Created attachment 838236 [details]
File: triggerbug.tar.gz

Comment 5 Iago Rubio 2013-12-18 11:26:50 UTC
Created attachment 838264 [details]
Proposed patch to add default values to the missing fields in the XML report

gtester-report expect the fields "package", "version" and "revision" to exist in the XML file generated by gtester, but simple tests don't provide those fields to gtester and are missing in the generated XML file.

This causes an exception when running gtester-report with the generated XML file without those fields.

This patch adds a default value "unknown" to the package and version fields if they don't exists and avoids the revision line in the report if a revision don't exists in the XML.

Comment 6 Iago Rubio 2013-12-18 11:40:27 UTC
Comment on attachment 838236 [details]
File: triggerbug.tar.gz

Simple test case to reproduce the bug.

Comment 7 Iago Rubio 2013-12-19 09:32:43 UTC
Same bug confirmed in Fedora 20.

Same patch applies.

Looks like people are tweaking their makefiles to workaround this issue like in this chromium patch: http://git.chromium.org/gitweb/?p=chromiumos/third_party/libmbim.git;a=blobdiff;f=gtester.make;fp=gtester.make;h=40348dcd1dfc544c1bf4bcd89abba3f03fec4f0e;hp=0000000000000000000000000000000000000000;hb=d20e41ca6a90e335b89b7fcc386426f8d21ed259;hpb=a0a8d96d1b7c7db968ddb07216f0d8c6de12f1be

This issue can be fixed also by adding to the report file below <gtester> tag the <info> tag containing the package, version and revision:

<info>
<package>PACKAGENAME</package>
<version>VERSION</version>
<revision>REVISION</revision>
</info>

Or by creating a script to put all the test files together on a report collection with the format:

<?xml version="1.0"?>
<report-collection>
 (content of individual tests here)
</report-collection>

A example script could be:

#!/bin/sh

# variables change your settings here
PACKAGE=package
VERSION=version
REVISION=revision
REPORT_FILE="report.xml"
REPORTS_DIR="."

# script
FILES=`find $REPORT_DIR -name "*.xml"`
FNAME=$REPORTS_DIR/$REPORT_FILE

cat > $FNAME << EOF
<?xml version="1.0"?>
<report-collection>
  <info>
    <package>$PACKAGE</package>
    <version>$VERSION</version>
    <revision>$REVISION</revision>
  </info>
EOF

for f in $FILES; do cat $f | sed -e "1,1s/^<?xml\b[^>?]*?>//" >> $FNAME;done;

echo "</report-collection>" >> $FNAME;

gtester-report $FNAME

Comment 8 Philip Withnall 2014-08-19 07:36:48 UTC
Another user experienced a similar problem:

Don’t know, sorry.

reporter:       libreport-2.2.2
cmdline:        /usr/bin/python /usr/bin/gtester-report test-report.xml
executable:     /usr/bin/gtester-report
kernel:         3.14.15-100.fc19.x86_64
package:        glib2-devel-2.36.4-1.fc19
reason:         gtester-report:244:handle_info:KeyError: 'package'
runlevel:       N 5
type:           Python
uid:            1000

Comment 9 Fedora End Of Life 2015-01-09 20:53:56 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 10 Fedora End Of Life 2015-02-17 19:42:15 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.