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.sm...@example.com> Tue, 27 Sep 2016 14:08:04 -0600
Source: package
Version: 1.0-1
Distribution: codename
Urgency: medium
Maintainer: John Smith <john.sm...@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
package (1.0-1) codename; urgency=medium

  * minimal example reproducer

 -- John Smith <john.sm...@example.com> Tue, 27 Sep 2016 14:08:04 -0600
import debian.changelog

with open('changelog') as f:
    contents = f.read()
version = debian.changelog.Changelog(file=contents).get_version()

Reply via email to