Bug 241182

Summary: pirut crashes on empty group file
Product: Red Hat Enterprise Linux 5 Reporter: Martin Poole <mpoole>
Component: yumAssignee: James Antill <james.antill>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5.0CC: jhutar, katzj, tao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: RHBA-2008-0388 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-21 10:20:34 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Martin Poole 2007-05-24 07:47:48 EDT
Description of problem:

if pirut meets an empty group file (0 bytes) it crashes.
Whilst an empty file is not strictly xml, it is not useful to have the program

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


How reproducible:


Steps to Reproduce:
1. touch /path/to/repository/i386/base/emptygroups.xml
2. createrepo -c /path/to/repocache/i386 -g base/emptygroups.xml -q
Actual results:

Component: Software Manager
Summary: TB27ac5246 <string>:68:__iter__:SyntaxError: no element found: line 1,
column 0

Traceback (most recent call last):
 File "/usr/sbin/pirut", line 453, in ?
 File "/usr/sbin/pirut", line 449, in main
 File "/usr/sbin/pirut", line 358, in run
 File "/usr/sbin/pirut", line 373, in doRefresh
 File "/usr/lib/python2.4/site-packages/pirut/__init__.py", line 151, in reposSetup
 File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 408, in doGroupSetup
 File "/usr/lib/python2.4/site-packages/yum/comps.py", line 337, in add
   for event, elem in parser:
 File "<string>", line 68, in __iter__
SyntaxError: no element found: line 1, column 0

Local variables in innermost frame:
p: <XMLParser object at 0xa88f170>
self: <iterparse object at 0xa8b534c>
b: <TreeBuilder object at 0xa855560>
events: []

Expected results:

silently ignore empty file.

Additional info:
Comment 1 Martin Poole 2007-05-24 07:49:21 EDT
Additional reproducer notes.....

On client clean the metadata-caches:
       # yum clean all
Then run pup / pirut:
       # pup ----> crash
Yum works:
       # yum
Comment 2 Jeremy Katz 2007-05-29 14:08:17 EDT
I suspect 'yum groupinstall' will fail also...

The right thing to do here is to catch the empty parser in the yum comps parser
rather than adding handling in every caller of the yum API.  Should be
straight-forward enough to do
Comment 4 RHEL Product and Program Management 2007-10-15 23:59:06 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
Comment 10 errata-xmlrpc 2008-05-21 10:20:34 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.