Bug#844026: Please handle malformed changelogs with more specific exceptions

Joe Bisch joseph.bisch at hpe.com
Fri Nov 11 21:40:10 UTC 2016


Package: python-debian
Version: 0.1.29

I am getting a generic IndexError when I try to parse the attached
changelog using the attached reproducer script. I would expect a more
specific exception from python-debian. Dpkg-parsechangelog is able to
identify that the trailer line is badly formatted. (The issue is that
there is only a single space between the email address and the
timestamp).

Using the attached changelog with dpkg-parsechangelog, I get the following
results:

$ dpkg-parsechangelog
dpkg-parsechangelog: warning:     debian/changelog(l5): badly formatted trailer line
LINE:  -- John Smith <john.smith at example.com> Tue, 27 Sep 2016 14:08:04 -0600
Source: package
Version: 1.0-1
Distribution: codename
Urgency: medium
Maintainer: John Smith <john.smith at example.com>
Timestamp: 1475006884
Date: Tue, 27 Sep 2016 14:08:04 -0600
Changes:
 package (1.0-1) codename; urgency=medium
  .
     * minimal example reproducer

whereas the script I have attached gives:

$ python3 reproducer.py
Traceback (most recent call last):
  File "reproducer.py", line 5, in <module>
    version = debian.changelog.Changelog(file=contents).get_version()
  File "/usr/lib/python3.5/site-packages/debian/changelog.py", line 465, in get_version
    return self._blocks[0].version
IndexError: list index out of range

-- 
Joe Bisch
HPE Linux, Hewlett Packard Enterprise
-------------- next part --------------
package (1.0-1) codename; urgency=medium

  * minimal example reproducer

 -- John Smith <john.smith at example.com> Tue, 27 Sep 2016 14:08:04 -0600
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reproducer.py
Type: text/x-python
Size: 144 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-python-debian-maint/attachments/20161111/ba8e1982/attachment.py>


More information about the pkg-python-debian-maint mailing list