apt-rpm empty changelog bug fix

David Smid david at unity-linux.org
Thu Jul 9 00:09:32 PDT 2009


Hello,

My name is David Smid and I am one of the Unity Linux developers.
Unity Linux uses RPM5 together with Smart for package management.

We have come across a bug in RPM5's python-rpm binding (shared library
_rpmmodule.so).
When there's no changelog in apt-rpm repository metadata, hdr_subscript function
calls PyString_FromString with NULL argument. That causes instant Segmentation
fault in Smart.

I fixed the bug by calling PyString_FromString with empty string argument but
there's another problem, this time in Smart:

When I select uninstalled package and click on Changelog tab in GTK GUI, I get
this error:
------------------------------------
Traceback (most recent call last):

  File "/usr/lib/python2.6/site-packages/smart/interfaces/gtk/packageinfo.py",
line 189, in _switchPage
    self.setPackage(self._pkg, _pagenum=pagenum)

  File "/usr/lib/python2.6/site-packages/smart/interfaces/gtk/packageinfo.py",
line 308, in setPackage
    changelog = info.getChangeLog()

  File "/usr/lib/python2.6/site-packages/smart/backends/rpm/header.py", line
159, in getChangeLog
    self._change[2*i] =
datetime.fromtimestamp(logtime[i]).strftime("%Y-%m-%d")+"  "+ logname[i]

IndexError: list index out of range
------------------------------------

The problem is that the array self._h[rpm.RPMTAG_CHANGELOGTIME] is empty while
self._h[rpm.RPMTAG_CHANGELOGTEXT] is not.
I fixed that by checking its length beforehand.

See http://issues.unity-linux.org/index.php?do=details&task_id=5


Best regards,

David Smid

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smart-1.2_empty_changelog_fix.patch
Type: text/x-patch
Size: 811 bytes
Desc: not available
URL: <http://lists.labix.org/pipermail/smart-labix.org/attachments/20090709/932bb14b/attachment-0002.bin>


More information about the Smart mailing list