SyntaxError in plugin with lazy-registered command causes crash on "bzr help hidden-commands"

Bug #616932 reported by Zearin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

First, some info on my installation:

*******************************************************
Tonys-MacBook-Pro:.bazaar amrogers$ bzr version
Bazaar (bzr) 2.2.0
  Python interpreter: /usr/bin/python 2.6.1
  Python standard library: /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
  Platform: Darwin-10.4.0-i386-64bit
  bzrlib: /Library/Python/2.6/site-packages/bzrlib
  Bazaar configuration: /Users/amrogers/.bazaar
  Bazaar log file: /Users/amrogers/.bzr.log

Copyright 2005-2010 Canonical Ltd.
http://bazaar.canonical.com/

bzr comes with ABSOLUTELY NO WARRANTY. bzr is free software, and
you may use, modify and redistribute it under the terms of the GNU
General Public License version 2 or later.

Bazaar is part of the GNU Project to produce a free operating system.
*******************************************************
Tonys-MacBook-Pro:.bazaar amrogers$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
*******************************************************
Tonys-MacBook-Pro:.bazaar amrogers$ python -V
Python 2.7
*******************************************************
Running OS X Snow Leopard (10.6.4) on 64-bit architecture.
*******************************************************

I see that Bazaar is using an older version of Python on my system. Not sure what to think about that.

So there are a couple of commands that will actually result in a very similar error, but I put "help hidden-commands" in the Summary line of this bug because that's the command whose traceback I posted below.

Here it is:

*******************************************************
Tonys-MacBook-Pro:.bazaar amrogers$ bzr help hidden-commands
bzr: ERROR: exceptions.SyntaxError: invalid syntax (extract.py, line 144)

Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 911, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 1111, in run_bzr
    ret = run(*run_argv)
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 689, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 704, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/bzrlib/cleanup.py", line 135, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/Library/Python/2.6/site-packages/bzrlib/cleanup.py", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 1126, in ignore_pipe
    result = func(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/bzrlib/builtins.py", line 4246, in run
    bzrlib.help.help(topic)
  File "/Library/Python/2.6/site-packages/bzrlib/help.py", line 51, in help
    outfile.write(source.get_help_text(shadowed_terms))
  File "/Library/Python/2.6/site-packages/bzrlib/help_topics/__init__.py", line 861, in get_help_text
    result = topic_registry.get_detail(self.topic)
  File "/Library/Python/2.6/site-packages/bzrlib/help_topics/__init__.py", line 90, in get_detail
    return obj(topic)
  File "/Library/Python/2.6/site-packages/bzrlib/help.py", line 77, in _help_commands_to_text
    shown_commands = [(n, o) for n, o in commands if o.hidden == hidden]
  File "/Library/Python/2.6/site-packages/bzrlib/help.py", line 76, in <genexpr>
    commands = ((n, _mod_commands.get_cmd_object(n)) for n in names)
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 240, in get_cmd_object
    return _get_cmd_object(cmd_name, plugins_override)
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 262, in _get_cmd_object
    cmd = hook(cmd, cmd_name)
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 332, in _get_plugin_command
    return plugin_cmds.get(cmd_name)()
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 90, in get
    return registry.Registry.get(self, real_name)
  File "/Library/Python/2.6/site-packages/bzrlib/registry.py", line 173, in get
    return self._dict[self._get_key_or_default(key)].get_obj()
  File "/Library/Python/2.6/site-packages/bzrlib/registry.py", line 61, in get_obj
    self._do_import()
  File "/Library/Python/2.6/site-packages/bzrlib/registry.py", line 70, in _do_import
    obj = __import__(self._module_name, globals(), locals(), names)
  File "/Users/amrogers/.bazaar/plugins/plugin_info/commands.py", line 26, in <module>
    from bzrlib.plugins.plugin_info.extract import *
  File "/Users/amrogers/.bazaar/plugins/plugin_info/extract.py", line 144
     <<<<<<< TREE
      ^
 SyntaxError: invalid syntax

bzr 2.2.0 on python 2.6.1 (Darwin-10.4.0-i386-64bit)
arguments: ['/usr/local/bin/bzr', 'help', 'hidden-commands']
encoding: 'UTF-8', fsenc: 'utf-8', lang: 'en_US.UTF-8'
plugins:
  bash_completion /Library/Python/2.6/site-packages/bzrlib/plugins/bash_completion [2.2.0]
  bzrtools /Library/Python/2.6/site-packages/bzrlib/plugins/bzrtools [2.2.0]
  colo /Library/Python/2.6/site-packages/bzrlib/plugins/colo [0.1.0]
  email /Library/Python/2.6/site-packages/bzrlib/plugins/email [unknown]
  explorer /Library/Python/2.6/site-packages/bzrlib/plugins/explorer [1.1.0dev2]
  extmerge /Library/Python/2.6/site-packages/bzrlib/plugins/extmerge [unknown]
  fastimport /Library/Python/2.6/site-packages/bzrlib/plugins/fastimport [0.9.0dev]
  keychain /Users/amrogers/.bazaar/plugins/keychain [0.1.0]
  launchpad /Library/Python/2.6/site-packages/bzrlib/plugins/launchpad [2.2.0]
  log_rss /Users/amrogers/.bazaar/plugins/log_rss [0.1.0dev]
  loom /Library/Python/2.6/site-packages/bzrlib/plugins/loom [2.2.1dev]
  netrc_credential_store /Library/Python/2.6/site-packages/bzrlib/plugins/netrc_credential_store [2.2.0]
  news_merge /Library/Python/2.6/site-packages/bzrlib/plugins/news_merge [2.2.0]
  pipeline /Library/Python/2.6/site-packages/bzrlib/plugins/pipeline [unknown]
  plugin_info /Users/amrogers/.bazaar/plugins/plugin_info [1.3.0dev]
  push_and_update /Users/amrogers/.bazaar/plugins/push_and_update [0.2.0dev]
  qbzr /Library/Python/2.6/site-packages/bzrlib/plugins/qbzr [0.20.0dev1]
  rewrite /Library/Python/2.6/site-packages/bzrlib/plugins/rewrite [0.6.0]
  stats /Users/amrogers/.bazaar/plugins/stats [unknown]
  svn /Library/Python/2.6/site-packages/bzrlib/plugins/svn [1.0.4dev]
  upload /Library/Python/2.6/site-packages/bzrlib/plugins/upload [1.0.0dev]
  xmloutput /Library/Python/2.6/site-packages/bzrlib/plugins/xmloutput [0.8.6]

*** Bazaar has encountered an internal error. This probably indicates a
    bug in Bazaar. You can help us fix it by filing a bug report at
        https://bugs.launchpad.net/bzr/+filebug
    including this traceback and a description of the problem.
*******************************************************

Tags: help plugin
Zearin (zearin)
description: updated
Revision history for this message
Andrew Bennetts (spiv) wrote :

So the immediate cause here is the plugin_info plugin you have installed in ~/.bazaar/plugins is broken, the .py file has a syntax error due to a "<<<<<<<" conflict marker.

So removing or fixing that plugin, or running with --no-plugins, would fix this for you.

bzr itself should cope better when a lazy-registered command from a plugin fails to load for whatever reason though, so this is also a valid bug in bzr.

Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
summary: - bzr crash on "bzr help hidden-commands"
+ SyntaxError in plugin with lazy-registered command causes crash on "bzr
+ help hidden-commands"
Revision history for this message
Andrew Bennetts (spiv) wrote :

Actually, thinking again I'm not sure that lazy-registered commands are involved, but we should make sure that however a plugin registers commands bzr won't crash like this.

Vincent Ladeuil (vila)
tags: removed: bazaar bzr osx python
Jelmer Vernooij (jelmer)
tags: added: help plugin
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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