bzr overrides the shell prompt settings

Bug #249452 reported by Ignas Mikalajūnas
18
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
High
Martin Pool
bzr (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

The bazaar 1.6~beta3-1 packages are completely overriding shell prompt settings, the offending code in:

/etc/bash_completion.d/bzrbashprompt.sh

is:

if [ "$PS1" ]; then
 PS1='\u@\h:$(__prompt_bzr)\W\$ '
fi

it completely ignores any settings that were set before that.

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

This is quite unfriendly really. Whoops.

Changed in bzr:
importance: Undecided → Critical
status: New → Triaged
Revision history for this message
John A Meinel (jameinel) wrote :

I don't think this file is meant to be automatically installed. Isn't it just meant as an example that you can use if you want to?

This line certainly seems to indicate that the install to /etc/bash_completions.d is meant to be user initiated:

# modify PS1 to your preference and include this file in your bashrc
# or copy to /etc/bash_completions.d.

So is this just an issue in the packaging? As I don't see this being mentioned in any of the setup.py, etc stuff.

Revision history for this message
Martin Albisetti (beuno) wrote :

I'm having all kinds for weirdness in bash too since I installed bzr 1.6rc from PPA today.

It tries to do something in every directory I'm in.

Revision history for this message
Austin Chu (eefi) wrote :

It seems debian/bzr.install is set to take everything from contrib/bash/ and dump it into /etc/bash_completion.d/ . This was fine back when contrib/bash/ only had bash_completion extensions, but the newly added bzrbashprompt.sh definitely does not belong there. Perhaps the catch-all contrib/bash/* line should be removed; contrib/bash/bzr and contrib/bash/bzr.simple should be explicitly put in /etc/bash_completion.d/; and contrib/bash/bzrbashprompt.sh should be put in /usr/share/doc/bzr/examples/.

Revision history for this message
Martin Pool (mbp) wrote :

EspeonEefi is correct about why this is active.

It is a bit of a trap that the packaging copies every file from that directory. The bzrbashprompt.sh script is not even a shell completion script, obviously.

Also, there are two shell completion scripts and probably just one would do...

Changed in bzr:
assignee: nobody → mbp
Revision history for this message
Martin Pool (mbp) wrote :

I think that when both scripts were present, both were run but bzr.simple was run second and so overrode the previous script. It seems to give better completion suggestions because it parses bzr help output to get a full list, but it does not know anything about completion of options, whereas 'bash/bzr' does have a few options hardcoded in. For now I'll go with bzr.simple as the smallest change from the current behaviour.

Revision history for this message
Martin Pool (mbp) wrote :

I applied this patch, and have uploaded a fixed package to the hardy beta ppa.

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

Just installed the new package today (on hardy):

    $ dpkg --status bzr | grep ^Version
    Version: 1.6~beta3-1~bazaar2
    $ dpkg -L bzr | grep completion
    /etc/bash_completion.d
    /etc/bash_completion.d/bzr.simple
    /etc/bash_completion.d/bzr
    /etc/bash_completion.d/bzrbashprompt.sh

So the file still seems to be getting distributed.

Revision history for this message
Martin Pool (mbp) wrote :

Thanks for reporting that.

There is something odd happening because I just see

mbp@grace% dpkg --status bzr|grep \^Version
Version: 1.6~beta3-1~bazaar2
mbp@grace% dpkg -L bzr | grep completion
/etc/bash_completion.d
/etc/bash_completion.d/bzr.simple
/etc/bash_completion.d/bzr

But even this is wrong, there should have been just one completion script after that change.

Maybe one of them is being treated as a config file.

Revision history for this message
Martin Pool (mbp) wrote :

OK, the problem is that files under /etc are considered configuration files and not automatically removed if they are absent from a later version of the package. I believe the standard way to remove them is from the postinst file, as in this patch.

Revision history for this message
Martin Pool (mbp) wrote :

Packages with this fixed are now in https://edge.launchpad.net/~bzr-beta-ppa/+archive

Changed in bzr:
status: Triaged → Fix Committed
Revision history for this message
Martin Pool (mbp) wrote :

Can people who've experienced this please try the new package and post on this bug whether it fixes their problem or not. Thanks.

Martin Pool (mbp)
Changed in bzr:
status: Fix Committed → Fix Released
Revision history for this message
LaMont Jones (lamont) wrote :

The dapper 1.6~rc2-1~bazaar1~dapper1 package still has this bug present.

Please make sure it's fixed in all the ppa varieties for rc3.

thanks,
lamont

Changed in bzr:
status: Fix Released → Confirmed
Revision history for this message
Martin Albisetti (beuno) wrote :

Fixed in 1.6~rc3-1~bazaar1~dapper1

Thanks :)

Changed in bzr:
status: Confirmed → Fix Released
Martin Pool (mbp)
Changed in bzr:
importance: Critical → High
status: Fix Released → Confirmed
Revision history for this message
Martin Pool (mbp) wrote :

I'm sorry to say this doesn't seem to have been fixed: the packaging-dapper branch has the diff in the root of the source tree where it's ignored during packaging. What we need is to actually apply the diff, creating a file debian/bzr.postinst.

Changed in bzr:
status: Confirmed → In Progress
Revision history for this message
Martin Pool (mbp) wrote :

This is now fixed in our PPA but still needs to be fixed in Debian and Ubuntu.

Changed in bzr:
status: In Progress → Fix Released
Jelmer Vernooij (jelmer)
Changed in bzr (Ubuntu):
status: New → Fix Released
status: Fix Released → Confirmed
Revision history for this message
Max Bowsher (maxb) wrote :

This bug only existed in 1.6beta packages, i.e. from the bzr-beta-ppa. It never affected the Ubuntu primary archive.

Changed in bzr (Ubuntu):
status: Confirmed → Invalid
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.