bzr merge-upstream crashes if no version is given

Bug #911262 reported by Gediminas Paulauskas on 2012-01-03
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bzr-builddeb
Medium
Jelmer Vernooij

Bug Description

If only the upstream tarball is given to merge-upstream, it crashes:

$ bzr mu ../zope.index_3.6.3.orig.tar.gz
Using distribution precise
bzr: ERROR: exceptions.AssertionError:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 923, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 1128, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 676, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 698, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/cleanup.py", line 135, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/cleanup.py", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/plugins/builddeb/cmds.py", line 784, in run
    assert isinstance(version, str)
AssertionError

This means that no "--version" parameter was given. It should at least print a human-readable error message and exit(1), not assert.

In other case when not enough information is given -- only the version, not the upstream tarball -- bzr-builddeb uses debian/watch to download the needed file. Maybe similar approach (or uscan) can be used here to automatically guess the version number from upstream (or .orig.tar.gz) file name.

ProblemType: Crash
DistroRelease: Ubuntu 12.04
Package: bzr 2.5.0~beta4-1ubuntu1
ProcVersionSignature: Ubuntu 3.2.0-7.13-generic-pae 3.2.0-rc7
Uname: Linux 3.2.0-7-generic-pae i686
NonfreeKernelModules: nvidia
ApportVersion: 1.90-0ubuntu1
Architecture: i386
BzrDebugFlags: set()
BzrVersion: 2.5b4
CommandLine: ['/usr/bin/bzr', 'mu', '../zope.index_3.6.3.orig.tar.gz']
CrashDb: bzr
Date: Tue Jan 3 16:13:31 2012
ExecutablePath: /usr/bin/bzr
FileSystemEncoding: UTF-8
InterpreterPath: /usr/bin/python2.7
Locale: lt_LT.UTF-8
PackageArchitecture: all
Platform: Linux-3.2.0-7-generic-pae-i686-with-Ubuntu-12.04-precise
ProcCmdline: /usr/bin/python /usr/bin/bzr mu ../zope.index_3.6.3.orig.tar.gz
PythonVersion: 2.7.2
SourcePackage: bzr
Title: bzr crashed with AssertionError in run()
UpgradeStatus: Upgraded to precise on 2011-12-29 (4 days ago)
UserEncoding: UTF-8
UserGroups: adm admin cdrom dialout dip libvirtd lpadmin plugdev sambashare

Related branches

Gediminas Paulauskas (menesis) wrote :
visibility: private → public
affects: bzr-builddeb (Ubuntu) → bzr-builddeb
Jelmer Vernooij (jelmer) wrote :

This is fixed in newer versions of bzr-builddeb.

Changed in bzr-builddeb:
status: New → Fix Released
Gediminas Paulauskas (menesis) wrote :

No, I am running precise with bzr-builddeb 2.8.0, also tried with trunk.

The reason why assert fails is that extract_tarball_version returns an unicode string

(Pdb) n
AssertionError: AssertionError()
> /home/menesis/.bazaar/plugins/builddeb/cmds.py(800)run()
-> assert isinstance(version, str)
(Pdb) version
u'1.0'

Even if I make it str, get a different error:

$ bzr mu ../z3c.ptcompat-1.0.tar.gz
Using distribution precise
Using version string 1.0.
bzr: ERROR: z3c.ptcompat 1.0 was not found in <bzrlib.plugins.builddeb.upstream.TarfileSource object at 0x93a2dac>.

Attached patch makes it work.

Changed in bzr-builddeb:
status: Fix Released → Confirmed

Am 04/01/12 19:16, schrieb Gediminas Paulauskas:
> No, I am running precise with bzr-builddeb 2.8.0, also tried with trunk.
>
Sorry, I confused this with a similar bug that we did indeed fix a while
ago.

Cheers,

Jelmer

Jelmer Vernooij (jelmer) on 2012-01-04
Changed in bzr-builddeb:
status: Confirmed → In Progress
importance: Undecided → Medium
assignee: nobody → Jelmer Vernooij (jelmer)
milestone: none → 2.8.1
Jelmer Vernooij (jelmer) on 2012-01-05
Changed in bzr-builddeb:
status: In Progress → Fix Committed
Jelmer Vernooij (jelmer) on 2012-01-18
Changed in bzr-builddeb:
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