Bug 491406

Summary: yum info crashes on empty %description`
Product: Red Hat Enterprise Linux 5 Reporter: Harriet Severino <hseverino>
Component: yumAssignee: James Antill <james.antill>
Status: CLOSED ERRATA QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: low    
Version: 5.2CC: bperkins, ffesti, herrold, james.antill, pmatilai, rlerch, tla
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Because every rpm package should have a %description field, yum info did not allow for packages where this field might be empty. When yum info encountered such a package, it would crash. Yum info now allows for empty %description fields in packages and will not crash when it encounters an empty field.
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-02 03:34:16 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Attachments:
Description Flags
rpm to re-create bug
none
spec file to re-create bug none

Description Harriet Severino 2009-03-20 15:34:33 EDT
Description of problem:
If  you have an RPM,
and the %description is empty,
and you upload it to the yum repository,
and the package is not installed,
and you do a yum info on it,
yum crashes.


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


How reproducible:


Steps to Reproduce:
1. get an RPM of an uninstalled package with %description is empty
2. upload it to the yum repository
3. do a yum info on it
  
Actual results:
yum crashes

Expected results:
info printed

Additional info:
Comment 1 R P Herrold 2009-03-20 16:14:37 EDT
With what rpm building tool was the package built?
Comment 2 seth vidal 2009-03-20 16:30:48 EDT
Can you attach a file with the crash, too?
Comment 3 seth vidal 2009-03-20 16:40:17 EDT
I've done some tests here.

With a <description></description> field in the xml metadata and db metadata - yum behaves properly.

I cannot generate a non-existent description field in the rpm itself. rpmbuild won't let me. So I echo russ' question.

please provide the crash, how you made the rpm itself and, if possible, attach the rpm.

Thanks
Comment 4 Harriet Severino 2009-03-23 14:35:49 EDT
Created attachment 336340 [details]
rpm to re-create bug
Comment 5 Harriet Severino 2009-03-23 14:36:22 EDT
Created attachment 336342 [details]
spec file to re-create bug
Comment 6 Harriet Severino 2009-03-23 14:38:00 EDT
Output from yum error:

hseverino@flurry8:/usr/src/redhat/RPMS/x86_64>yum info foo
Loading "security" plugin
Loading "rhnplugin" plugin
*Note* Red Hat Network repositories are not listed below. You must run this command as root to access RHN repositories.
RHN support will be disabled.
Available Packages
Name   : foo
Arch   : x86_64
Version: 1
Release: 1
Size   : 1.1 k
Repo   : SiCortex Inhouse
Summary: foo
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in ?
    yummain.main(sys.argv[1:])
  File "/usr/share/yum-cli/yummain.py", line 105, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/cli.py", line 293, in doCommands
    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
  File "/usr/share/yum-cli/yumcommands.py", line 178, in doCommand
    rap = base.listPkgs(ypl.available, 'Available Packages', basecmd)
  File "/usr/share/yum-cli/output.py", line 306, in listPkgs
    self.infoOutput(pkg)
  File "/usr/share/yum-cli/output.py", line 277, in infoOutput
    print _("Description:\n%s") % enc(pkg.description)
  File "/usr/share/yum-cli/output.py", line 258, in enc
    if len(s) > 0:
TypeError: len() of unsized object
Comment 7 seth vidal 2009-03-23 15:00:24 EDT
The package you attached is pretty badly corrupted.

I built a package from the spec file you attached and that operates just fine.

Can you rebuild from your spec file and generate the same error?
Comment 8 Harriet Severino 2009-03-23 15:06:56 EDT
Output from yum error:

hseverino@flurry8:/usr/src/redhat/RPMS/x86_64>yum info foo
Loading "security" plugin
Loading "rhnplugin" plugin
*Note* Red Hat Network repositories are not listed below. You must run this command as root to access RHN repositories.
RHN support will be disabled.
Available Packages
Name   : foo
Arch   : x86_64
Version: 1
Release: 1
Size   : 1.1 k
Repo   : SiCortex Inhouse
Summary: foo
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in ?
    yummain.main(sys.argv[1:])
  File "/usr/share/yum-cli/yummain.py", line 105, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/cli.py", line 293, in doCommands
    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
  File "/usr/share/yum-cli/yumcommands.py", line 178, in doCommand
    rap = base.listPkgs(ypl.available, 'Available Packages', basecmd)
  File "/usr/share/yum-cli/output.py", line 306, in listPkgs
    self.infoOutput(pkg)
  File "/usr/share/yum-cli/output.py", line 277, in infoOutput
    print _("Description:\n%s") % enc(pkg.description)
  File "/usr/share/yum-cli/output.py", line 258, in enc
    if len(s) > 0:
TypeError: len() of unsized object
Comment 9 seth vidal 2009-03-23 15:10:00 EDT
what ver of yum and rpm and rpm-python is this?

rpm -q yum rpm rpm-python
Comment 10 Harriet Severino 2009-03-23 15:13:41 EDT
I have built this rpm multiple times, with the same result. I

1) build the rpm with 
> rpmbuld foo-bar.spec
2) copy the rpm file into the repo
3) In the repo
> createrepo --update .
4) back on the build machine:
> yum info foo
Comment 11 Harriet Severino 2009-03-23 15:14:46 EDT
> rpm -q yum rpm rpm-python
yum-3.2.8-9.el5
rpm-4.4.2-48.el5
rpm-python-4.4.2-48.el5
Comment 12 Harriet Severino 2009-03-23 15:15:33 EDT
> rpm -q yum rpm rpm-python
yum-3.2.8-9.el5
rpm-4.4.2-48.el5
rpm-python-4.4.2-48.el5
Comment 13 seth vidal 2009-03-23 15:16:04 EDT
get rid of the --update to createrepo and see if everything gets more sane.
Comment 14 Harriet Severino 2009-03-23 15:24:07 EDT
I did a
> createrepo .
 and 
>yum info foo 
gives the same results.
Comment 15 seth vidal 2009-03-23 17:16:55 EDT
okay, Found the problem - it was fixed in yum 3.2.21 but not backported to rhel.
Comment 16 Harriet Severino 2009-03-23 17:40:26 EDT
Great. CanI get the rpm? http://yum.baseurl.org/ lists src rpms and src tarballs, and I'm just not that masochistic.
Comment 21 Ruediger Landmann 2009-09-01 15:06:09 EDT
Release note added. If any revisions are required, please set the 
"requires_release_notes" flag to "?" and edit the "Release Notes" field accordingly.
All revisions will be proofread by the Engineering Content Services team.

New Contents:
Because every rpm package should have a %description field, yum info did not allow for packages where this field might be empty. When yum info encountered such a package, it would crash. Yum info now allows for empty %description fields in packages and will not crash when it encounters an empty field.
Comment 22 errata-xmlrpc 2009-09-02 03:34:16 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 therefore 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.

http://rhn.redhat.com/errata/RHBA-2009-1419.html