Bazaar Version Control System

/usr/bin/bzr incorrectly uses /usr/bin/env python

Reported by Barry Warsaw on 2007-08-22
4
Affects Status Importance Assigned to Milestone
Bazaar
Undecided
Unassigned
bzr (Ubuntu)
Undecided
Unassigned

Bug Description

I just upgraded feisty with bzr 0.90~rc1-1 through update-manager. Then I tried to do a "bzr --version" and this complained about not being able to find bzrlib.

The problem is that /usr/bin/bzr incorrectly invokes python on its #! line.

It uses "#!/usr/bin/env python" which is the appropriate line to use for source installations but it is not the right line to use for system installations. A system tool requires the system python, not the first python on your $PATH. This breaks for everybody who develops Python or has another python on their $PATH.

No system tool ever should use "#!/usr/bin/env python" and in fact setuptools/distutils style packages always rewrite these lines to use a specific version of Python (whichever one the package was installed with). For basic Ubuntu system packages, this should always be "#!/usr/bin/python".

Note that you want your packager to do the right thing here. Just tweaking that line in the source code repository isn't right either because then it will be broken for bzr developers using and testing different python's than the system one.

Martin Pool (mbp) wrote :

So just to confirm, you're saying we should not change this in bzr upstream, but should tell packagers to set that, and do so in Ubuntu?

Barry Warsaw (barry) wrote :

Correct. If I branch a development copy from upstream's vcs, I should see the /usr/bin/env line. If I install bzr using `python setup.py install` <wink>, it would rewrite that line to /usr/bin/python in that line in the installed /usr/bin/bzr. Because Ubuntu's installation system doesn't use setuptools, packages themselves are going to have to do this rewrite so that /usr/bin/bzr ends up with /usr/bin/python in the #! line.

> Correct. If I branch a development copy from upstream's vcs, I should
> see the /usr/bin/env line. If I install bzr using `python setup.py
> install` <wink>, it would rewrite that line to /usr/bin/python in that
> line in the installed /usr/bin/bzr. Because Ubuntu's installation
> system doesn't use setuptools, packages themselves are going to have to
> do this rewrite so that /usr/bin/bzr ends up with /usr/bin/python in the
> #! line.

The rewrite can be done by passing --executable "/usr/bin/python" to
setup.py. I changed this in the latest upload to Debian, so should be in
the next upload to Ubuntu.

Martin Pool (mbp) wrote :

This doesn't need any changes in bzr upstream.

Changed in bzr:
status: New → Invalid
Martin Pool (mbp) wrote :

Looks like this will be fixed when we next merge from dato.

Changed in bzr:
status: New → In Progress
Basilio Kublik (sourcercito) wrote :

bzr (0.90-1) unstable; urgency=low

...

  * Use "/usr/bin/python" in the she-bang line instead of "/usr/bin/env
    python". Rationale in LP: #134046 is right.

 -- Adeodato Simó <email address hidden> Wed, 29 Aug 2007 12:29:26 +0200

Changed in bzr:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers