[sponsor-patch] Chokes on badly formatted changelog

Bug #806633 reported by Stefano Rivera on 2011-07-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-dev-tools (Ubuntu)
Medium
Stefano Rivera

Bug Description

Sponsor-patch died horribly in the face of a broken changelog entry:

$ sponsor-patch -s 755954
sponsor-patch: https://launchpad.net/bugs/755954 has 2 Ubuntu tasks:
1) opendrim-lmp-powersupply
2) opendrim-lmp-powersupply (oneiric)
To which Ubuntu tasks do the patch belong? 2
Branched 2 revision(s).
+N debian/patches/
+N debian/patches/01-ftbfs-add-opendrim-lib.patch
+N debian/patches/series
 M acinclude.m4
 M debian/changelog
All changes applied successfully.
Traceback (most recent call last):
  File "/usr/bin/sponsor-patch", line 123, in <module>
    main()
  File "/usr/bin/sponsor-patch", line 114, in main
    options.upload, workdir, options.verbose)
  File "/usr/lib/python2.6/dist-packages/ubuntutools/sponsor_patch/sponsor_patch.py", line 313, in sponsor_patch
    if update_maintainer("debian", verbose) != 0:
  File "/usr/lib/python2.6/dist-packages/ubuntutools/update_maintainer.py", line 124, in update_maintainer
    distribution = _get_distribution(changelog_file).split("-")[0]
  File "/usr/lib/python2.6/dist-packages/ubuntutools/update_maintainer.py", line 87, in _get_distribution
    return changelog.distributions
  File "/usr/lib/pymodules/python2.6/debian/changelog.py", line 480, in <lambda>
    distributions = property(lambda self: self._blocks[0].distributions,
IndexError: list index out of range

The changelog in question had no spaces before the first bulleted item. Don't know if this is something you want to catch. Using -e worked here, so maybe an error like this should drop the user into a shell to fix the source package?

Benjamin Drung (bdrung) wrote :

sponsor-patch shouldn't crash. It should tell the user that the changelog entry is malformed and ask the user to fix it.

Changed in ubuntu-dev-tools (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Stefano Rivera (stefanor) wrote :

Committed a fix to this bug. If you want to add a check for a malformed changelog entry, something like this should work:
debian.changelog.Changelog().parse_changelog(open("debian/changelog"), max_blocks=1, strict=True)

Changed in ubuntu-dev-tools (Ubuntu):
assignee: nobody → Stefano Rivera (stefanor)
status: Triaged → Fix Committed
Stefano Rivera (stefanor) wrote :

Done that too

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-dev-tools - 0.131

---------------
ubuntu-dev-tools (0.131) unstable; urgency=low

  [ Stefano Rivera ]
  * doc/requestsync.1: Correct default value for REQUESTSYNC_SMTP_SERVER
    (LP: #844992)
  * import-bug-from-debian: Bugs are filed against source packages in Ubuntu.
    (LP: #844734)
  * Debian source publication records are all Published now, not pending
    (LP: #845487)
  * requestsync:
    - Add nice error messages to gpg-signing code, rather than simple
      assertions (LP: #537288)
    - Extract current Ubuntu delta from changelog entries and provide for
      editing (LP: #547925)
  * submittodebian:
    - Don't parse the entire changelog, to avoid bumping into past illegal
      version numbers (LP: #727314)
    - Iterate over changelog blocks rather than using Changelog's private
      _blocks list.
  * LP: #806633:
    - ubuntutools.update_maintainer: Don't use strict changelog parsing
    - sponsor-patch: Perform strict validation on the first changelog entry.
  * setup-packaging-environment:
    - Software Sources isn't on the Administration menu, post Gnome 2
      (LP: #841975)
    - Use apt-get rather than aptitude.
  * Removed get-build-deps, mk-build-deps -ir is equivalent (LP: #158108)
  * ubuntutools.archive:
    - Add quiet option to silence downloading.
    - Use wget-style progress bar (fixed width) (LP: #845787)
  * Bump python-debian B-D and Depends to 0.1.20 for unicode Changelog
    reading.
  * backportpackage: Use absolute path of workdir when test-building.

  [ Colin Watson ]
  * syncpackage: Fix typo.

  [ Benjamin Drung ]
  * ubuntutools/requestsync: Follow PEP 8 naming conventions.

 -- Stefano Rivera <email address hidden> Sat, 10 Sep 2011 16:48:23 +0200

Changed in ubuntu-dev-tools (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers