Bug 191172 - yum crashes when no changelog data are available
yum crashes when no changelog data are available
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: yum-utils (Show other bugs)
5
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Seth Vidal
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-05-09 11:01 EDT by Roland Wolters
Modified: 2007-11-30 17:11 EST (History)
3 users (show)

See Also:
Fixed In Version: 3.0.x
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-02-14 09:03:04 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Handle packages with no changelogs (879 bytes, patch)
2006-06-01 15:00 EDT, Panu Matilainen
no flags Details | Diff

  None (edit)
Description Roland Wolters 2006-05-09 11:01:39 EDT
Description of problem:
The yum-changelog command does not work with rpms which do not contain any 
changelog information. Although every file should contain changelog 
information this problem should not brake down yum I think.

The problem appears for example if I want to update the ifolder server. The 
server rpms are provided as a yum repository by the ifolder project.

Here is the changelog output of such a file:
# rpm -q --changelog ifolder3-server
(none)[yum.repos.d]# 

Note that there is not even a new line created!

Here is the error output of yum:
yum --changelog update ifolder3-server
Loading "changelog" plugin
[...]
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package ifolder3-server.i386 0:3.5.6129.1-1 set to be updated
--> Running transaction check
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 138, in main
    (result, resultmsgs) = base.buildTransaction()
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 402, in 
buildTransaction
    self.plugins.run('postresolve', rescode=rescode, restring=restring)
  File "/usr/lib/python2.4/site-packages/yum/plugins.py", line 164, in run
    func(conduitcls(self, self.base, conf, **kwargs))
  File "/usr/lib/yum-plugins/changelog.py", line 97, in postresolve_hook
    origpkgs[n] = times[0]
IndexError: list index out of range
Comment 1 Panu Matilainen 2006-06-01 15:00:25 EDT
Created attachment 130358 [details]
Handle packages with no changelogs

Could you try whether the attached patch to changelog plugin will fix it? It
should but I don't have a testcase at hand here...
Comment 2 Roland Wolters 2006-06-01 20:51:07 EDT
I did a
patch -i yum-changelog-nochangelog.patch changelog.py
downgraded to an old version of the ifolder3-server and tried to update using 
yum with --changelog , and it crashed again:
Changes in packages about to be updated:
ifolder3-server - 3.5.6151.1-1.i386, ifolder3-server - 3.5.6152.1-1.i386
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 138, in main
    (result, resultmsgs) = base.buildTransaction()
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 402, in 
buildTransaction
    self.plugins.run('postresolve', rescode=rescode, restring=restring)
  File "/usr/lib/python2.4/site-packages/yum/plugins.py", line 164, in run
    func(conduitcls(self, self.base, conf, **kwargs))
  File "/usr/lib/yum-plugins/changelog.py", line 104, in postresolve_hook
    show_changes(conduit, 'Changes in packages about to be updated:')
  File "/usr/lib/yum-plugins/changelog.py", line 63, in show_changes
    for line in changelog_delta(srpms[name][0], origpkgs[name]):
  File "/usr/lib/yum-plugins/changelog.py", line 35, in changelog_delta
    for date, author, message in pkg.returnChangelog():
  File "/usr/lib/python2.4/site-packages/repomd/packageObject.py", line 79, in 
returnChangelog
    return self.changelog
AttributeError: YumInstalledPackage instance has no attribute 'changelog'

In case you want to set up a testcase fast:
Copy this repo-file to your /etc/yum.repos.d/*:
http://forgeftp.novell.com/ifolder/server/3.5/iFolderServer-Fedora.repo
Install the server:
yum install ifolder3-server
Downgrade to an older version:
rpm -Uvh --force 
http://forgeftp.novell.com/ifolder/server/3.5/20060531-1507/linux/FEDORA-CORE-5.0-i386/rpms/ifolder3-server-3.5.6151.1-1.i386.rpm

Update this with yum:
yum --changelog ifolder3-server

Whenever you want to test this again, reinstall the old server version (you 
can even make a rpm rollback if this is enabled in your system, which is not 
by default) and update again.
Comment 3 Panu Matilainen 2006-06-02 04:58:43 EDT
Ok, so it moves the crash to another spot, this latest crash is arguably a yum
bug as it blindly returns an attribute that doesn't necessarily exist. 

I'll add a workaround to the plugin for now but I think the proper fix is to
make yum do
if hasattr(self, 'changelog'):
    return self.changelog
else:
    return []

..or something like that. I'll have a closer look next week, a bit busy right now.
Comment 4 Tim Lauridsen 2007-02-14 09:03:04 EST
This is solved in the currrent version of yum, where changelog is a property, so
it is always defined.

Note You need to log in before you can comment on or make changes to this bug.