Failure to deal with empty changelog files

Bug #400589 reported by Muharem Hrnjadovic
22
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-debian (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: python-debian

When the changelog file is empty the following exception occurs:

{{{
  File "/var/lib/python-support/python2.6/debian_bundle/changelog.py", line 296, in parse_changelog
    if file[-1] != '\n':
IndexError: string index out of range
}}}

Please note: this is related to bug #360670.

Changed in python-debian (Ubuntu):
status: New → Confirmed
Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :

diff -Nru python-debian-0.1.13ubuntu1/debian/changelog python-debian-0.1.13ubuntu2/debian/changelog
--- python-debian-0.1.13ubuntu1/debian/changelog 2009-05-07 16:51:14.000000000 +0300
+++ python-debian-0.1.13ubuntu2/debian/changelog 2009-07-17 18:21:56.000000000 +0300
@@ -1,3 +1,10 @@
+python-debian (0.1.13ubuntu2) karmic; urgency=low
+
+ * fixed changelog parser exception raised when dealing with empty
+ changelog files (LP: #400589).
+
+ -- Muharem Hrnjadovic <email address hidden> Fri, 17 Jul 2009 18:04:18 +0300
+
 python-debian (0.1.13ubuntu1) karmic; urgency=low

   * Merge from debian unstable, remaining changes:
diff -Nru python-debian-0.1.13ubuntu1/debian_bundle/changelog.py python-debian-0.1.13ubuntu2/debian_bundle/changelog.py
--- python-debian-0.1.13ubuntu1/debian_bundle/changelog.py 2009-04-17 07:03:31.000000000 +0300
+++ python-debian-0.1.13ubuntu2/debian_bundle/changelog.py 2009-07-17 18:22:05.000000000 +0300
@@ -293,6 +293,10 @@
         state = first_heading
         old_state = None
         if isinstance(file, basestring):
+ # Make sure the changelog file is not empty.
+ if file is None or len(file.strip()) == 0:
+ self._parse_error('Empty changelog file.', strict)
+
             if file[-1] != '\n':
                 file += '\n'
             file = file.split('\n')[:-1]

Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :

The package is also available here: https://edge.launchpad.net/~al-maisan/+archive/ppa

Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :
Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :

james_w pointed out that an additional 'return' statement is needed since the code will continue to execute if the value of the 'strict' parameter is False

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-debian - 0.1.14

---------------
python-debian (0.1.14) unstable; urgency=low

  [ Stefano Zacchiroli ]
  * setup.py.in: switch to setuptools, which are able to generate eggs;
    add matching build-dep on python-setuptools (Closes: #525694)
  * examples/deb822/: add new example render-dctrl, to render packages in
    a dctrl-tools pipeline (using Markdown as long description syntax)
  * deb822: use __new__ to sub-class strings for case-insensitiveness;
    former approach is deprecated with python 2.6.
    Thanks to Loïc Minier for the patch. (Closes: #524061)

  [ Filippo Giunchedi ]
  * deb822: parse also Binary as PkgRelation, thus add .binary attribute

  [ Muharem Hrnjadovic ]
  * fixed changelog parser exception raised when dealing with empty
    changelog files (LP: #400589).

 -- James Westby <email address hidden> Tue, 25 Aug 2009 12:31:36 +0100

Changed in python-debian (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.