bzr serve shows error TypeError: not all arguments converted during string formatting

Bug #293697 reported by Alexandre
46
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
High
Jelmer Vernooij

Bug Description

$ bzr serve
listening on port: 4155
bzr: ERROR: exceptions.TypeError: not all arguments converted during string formatting

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 849, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 795, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 495, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 3934, in run
    smart_server.serve()
  File "/usr/lib/python2.5/site-packages/bzrlib/smart/server.py", line 113, in serve
    hook(backing_urls, self.get_url())
  File "/usr/lib/python2.5/site-packages/bzrlib/smart/server.py", line 151, in get_url
    return "bzr://%s:%d/" % self._sockname
TypeError: not all arguments converted during string formatting

bzr 1.8 on python 2.5.2 (linux2)
arguments: ['/usr/bin/bzr', 'serve']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'pt_BR.UTF-8'
plugins:
  avahi /usr/lib/python2.5/site-packages/bzrlib/plugins/avahi [0.3.0dev0]
  bzrtools /usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools [1.8.0]
  dbus /usr/lib/python2.5/site-packages/bzrlib/plugins/dbus [unknown]
  gtk /usr/lib/python2.5/site-packages/bzrlib/plugins/gtk [0.95.0]
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

Tags: hpss
Revision history for this message
Andrew Bennetts (spiv) wrote :

I see the cause. This bug can be provoked with the combination of:
  - bzr serve trying to use an IPv6 address (which may happen your system has IPv6 support installed, even if you don't have any working IPv6 interfaces)
  - having a server_started hook installed

Specifically, with an IPv6 socket getsockname() returns a 4-element tuple like ('::', 4155, 0, 0), instead of a 2-element one like ('0.0.0.0', 4155). But the get_url() function assumes that it always going to be a 2-element tuple.

Changed in bzr:
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Andrew Bennetts (spiv) wrote :

A probable workaround is to use "bzr serve --port=0.0.0.0:4155". This is the same workaround as for bug 286871.

Revision history for this message
Alexandre (lexrupy) wrote :

I will try this ASAP, for now I downgraded to 1.6.x and the error desapeared.

Revision history for this message
James Henstridge (jamesh) wrote :

It is also worth noting that the get_url() method would give an invalid URL for an IPv6 address (e.g. bzr://:::4155/ instead of bzr://[::]:4155/). Of course, a URL containing 0.0.0.0 or :: is probably not that useful to the user or any hooks.

Jelmer Vernooij (jelmer)
Changed in bzr:
status: Confirmed → In Progress
assignee: nobody → Jelmer Vernooij (jelmer)
Jelmer Vernooij (jelmer)
Changed in bzr:
status: In Progress → Fix Committed
Vincent Ladeuil (vila)
Changed in bzr:
milestone: none → 2.4b1
status: Fix Committed → 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.