bzrlib.plugin.load_plugins() loads system plugins even for non-system bzrlib

Bug #316192 reported by Michael Hudson-Doyle
8
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Vincent Ladeuil
Launchpad itself
Fix Released
High
Tim Penhey

Bug Description

Lauchpad uses our own branch of bzrlib, which is not quite up to date with bzr.dev currently. I have bzr installed from the nightly ppa. If I try to run our bzr executable, I get a message about a new plugin in the system location:

mwh@grond:trunk$ ./sourcecode/bzr/bzr rocks
'module' object has no attribute 'CredentialStore'
Unable to load plugin 'netrc_credential_store' from '/usr/lib/python2.5/site-packages/bzrlib/plugins'
It sure does!

Its definitely unfortunate that a system plugin can cause problems for my separate install of bzrlib.

Even setting BZR_PLUGIN_PATH doesn't help.

Tags: lp-code

Related branches

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 316192] [NEW] bzrlib.plugin.load_plugins() loads system plugins even for non-system bzrlib

I think there are two issues:
BZR_PLUGIN_PATH should override completely (perhaps with some magic
element to say 'the default path here').

And we shouldn't use the python path for an uninstalled bzr. We should
use it if bzr is installed, just not when running from a source dir.

-Rob

Revision history for this message
Martin Pool (mbp) wrote : Re: [Bug 316192] [NEW] bzrlib.plugin.load_plugins() loads system plugins even for non-system bzrlib

  status confirmed
  importance medium

--
Martin <http://launchpad.net/~mbp>

Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Vincent Ladeuil (vila) wrote :
Revision history for this message
Tim Penhey (thumper) wrote :

This causes problems in the launchpad code.

We are fixing it by explicitly passing in the plug-in directory to the load_plugins() call.

Changed in launchpad-bazaar:
assignee: nobody → thumper
importance: Undecided → High
milestone: none → 2.2.1
status: New → In Progress
Tim Penhey (thumper)
Changed in launchpad-bazaar:
status: In Progress → Fix Committed
Revision history for this message
Andrew Bennetts (spiv) wrote :

This appears to be affecting production code hosting:

$ ssh bazaar.launchpad.net bzr serve --inet --directory=/ --allow-writes
'module' object has no attribute 'CredentialStore'
Unable to load plugin 'netrc_credential_store' from '/usr/lib/python2.4/site-packages/bzrlib/plugins'

Revision history for this message
Tim Penhey (thumper) wrote : Re: [Bug 316192] Re: bzrlib.plugin.load_plugins() loads system plugins even for non-system bzrlib

On Tue, 27 Jan 2009 11:47:06 Andrew Bennetts wrote:
> This appears to be affecting production code hosting:
>
> $ ssh bazaar.launchpad.net bzr serve --inet --directory=/ --allow-writes
> 'module' object has no attribute 'CredentialStore'
> Unable to load plugin 'netrc_credential_store' from
> '/usr/lib/python2.4/site-packages/bzrlib/plugins'

This should be fixed on staging, so will be fixed for the upcoming rollout.

Paul Hummer (rockstar)
Changed in launchpad-bazaar:
status: Fix Committed → Fix Released
Revision history for this message
Vincent Ladeuil (vila) wrote :

See bug #412930 which fixes the issue by allowing:
  BZR_PLUGIN_PATH='-site'
Which ensures that bzr loads only its core plugins.

Changed in bzr:
assignee: nobody → Vincent Ladeuil (vila)
status: Confirmed → In Progress
status: In Progress → Fix Committed
Vincent Ladeuil (vila)
Changed in bzr:
milestone: none → 2.1
status: Fix Committed → Fix Released
Vincent Ladeuil (vila)
Changed in bzr:
milestone: 2.1.0 → 2.1b1
Revision history for this message
Gary Poster (gary) wrote :

When Launchpad upgrades to the version of bzr that has this fix, please look for lib/lp/codehosting/tests/test_lpserve.py and revert the ``assertFinishedCleanly`` to its formerly clean self. (If you see this before lp:~gary/launchpad/buildout-py merges, then you won't know what I'm talking about. There will be an XXX there referencing this bug once in merges.)

Revision history for this message
Robert Collins (lifeless) wrote :

LP will need to either set an environment variable or otherwise call into bzrlib to get this behaviour; so it won't be as simple as reverting something.

Revision history for this message
Vincent Ladeuil (vila) wrote :

If I'm not mistaken, LP *calls* bzrlib so it can either:
- continue to call bzrlib (setting the plugin path explicitly),
- stop calling bzrlib *AND* set BZR_PLUGIN_PATH to the appropriate value

I recommend the later, but the former should be perfectly safe.
I think Aaron (I'll subscribe him to this bug) implemented the LP part and understand the BZR_PLUGIN_PATH behavior,
so I would take his word as final.

Revision history for this message
Aaron Bentley (abentley) wrote :

In the test suite, lp calls "bzr lpserve" to serve branches, so that's why the environment variable is relevant. As an alternative, we could probably serve branches directly using bzrlib, but I'm not sure what's best.

Revision history for this message
Max Bowsher (maxb) wrote :

This seems to have regressed, given that I just had to uninstall my system bzr-gtk and bzr-rebase to avoid test failures in
lp.codehosting.tests.test_lpserve.TestLaunchpadServe - this is using db-devel r8806 i.e. 3.1.12 rollout, which uses bzr 2.1b3.

Changed in launchpad-code:
status: Fix Released → New
Revision history for this message
Max Bowsher (maxb) wrote :

Per discussion on #launchpad-dev, we will leave this bug closed and track the regression as bug 497731.

Changed in launchpad-code:
status: New → Fix Released
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.