New option in bash could use updated completion

Bug #60666 reported by Lukas Sabota
14
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)
Fix Released
Undecided
Mika Fischer

Bug Description

Apt in edgy now has a new command: autoremove. The /etc/bash_completion file should be changed to reflect this.

on line 2088:
COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \
                                dist-upgrade install remove source build-dep \
                                check clean autoclean` -- $cur ) )
can be changed to:

COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \
                                dist-upgrade install remove source build-dep \
                                check clean autoclean autoremove' -- $cur ) )

Micah Cowan (micahcowan)
Changed in bash:
status: Unconfirmed → Confirmed
Matthias Klose (doko)
Changed in bash:
assignee: nobody → doko
status: Confirmed → In Progress
Revision history for this message
Matthias Klose (doko) wrote :

fixed in 3.2-0ubuntu1

Changed in bash:
status: In Progress → Fix Released
Revision history for this message
Nicolò Chieffo (yelo3) wrote :

well I don't think it works... the auto-completion gives me apt-get operations, instead of packages: "remove autoremove install autoclean..."

Changed in bash:
status: Fix Released → Needs Info
Revision history for this message
Nicolò Chieffo (yelo3) wrote :

here is the correct patch to be added

Changed in bash:
status: Needs Info → Confirmed
Revision history for this message
Nicolò Chieffo (yelo3) wrote :

please, someone can consider my patch?

Revision history for this message
Juan Pablo Salazar Bertín (snifer) wrote :

Matthias, since there's a patch provided by Nicolò, is it possible that you change the bug status to triaged?
Or should we file a new bug?

Revision history for this message
Rolf Leggewie (r0lf) wrote :

Works fine for me on edgy. Is this still a problem for you?

$ apt-get <TAB> <TAB>
autoclean build-dep clean dselect-upgrade remove update
autoremove check dist-upgrade install source upgrade

Changed in bash:
status: Confirmed → Incomplete
Revision history for this message
Rolf Leggewie (r0lf) wrote :

> Works fine for me on edgy.

Well, not quite:

$ apt-get autoremove <TAB> <TAB>
autoclean build-dep clean dselect-upgrade remove update
autoremove check dist-upgrade install source upgrade

:-(

Changed in bash:
status: Incomplete → Triaged
Revision history for this message
Rolf Leggewie (r0lf) wrote :

Then, again, I would not expect

$ apt-get autoremove <TAB> <TAB>

to show me a list of packages as Nicolo's patch from comment 3 would entail. Thus I suggest that since

$ apt-get <TAB> <TAB>

is working correctly that the further requests should be rejected and this bug closed.

Revision history for this message
Nicolò Chieffo (yelo3) wrote : Re: [Bug 60666] Re: New option in bash could use updated completion

why would you not expect this? I would expect this since autoremove
can have a package name as an argument.

Revision history for this message
Juan Pablo Salazar Bertín (snifer) wrote :

At least in apt package version 0.7.6ubuntu4, autoremove doesn't use a package name as an argument, but according to the syntax in the man page you shouldn't mix different commands either.

Revision history for this message
Nicolò Chieffo (yelo3) wrote :

I've read the manual, you are definitely right.
But well, if you append a package name, the behavior is to remove it
and also remove the dependencies...
is this an unwanted behavior?

Revision history for this message
Juan Pablo Salazar Bertín (snifer) wrote :

I think you can achieve that by using:

apt-get --auto-remove remove [package]

Revision history for this message
Nicolò Chieffo (yelo3) wrote :

This way works, but this way it is necessary to add --auto-remove to
auto completion!

Revision history for this message
Nicolò Chieffo (yelo3) wrote :

this way should be ok...

Revision history for this message
Mika Fischer (zoop) wrote :

This is a bug in bash-completion, not bash.

Revision history for this message
Mika Fischer (zoop) wrote :

I cannot reproduce this problem on a current hardy install. Both --auto-remove and autoremove work fine.

Can anyone still reproduce this?

Changed in bash-completion:
status: Triaged → Incomplete
Revision history for this message
Nicolò Chieffo (yelo3) wrote :

there is no completion for --auto-remove: you can check in /etc/bash_completion

Revision history for this message
Mika Fischer (zoop) wrote :

You're probably not using hardy, right?

mika@arthur:~$ grep -- --auto-remove /etc/bash_completion
                                --tar-only --config-file --option --auto-remove' -- $cur ) )
mika@arthur:~$ dpkg -s bash-completion | grep Version
Version: 20060301-3

So I really believe this is fixed in hardy.

Revision history for this message
Nicolò Chieffo (yelo3) wrote :

I'm using hardy. Is it possible that you added it yourself in the past?

Revision history for this message
Mika Fischer (zoop) wrote :

mika@arthur:~/bct$ apt-get source bash-completion
[...]
dpkg-source: extracting bash-completion in bash-completion-20060301
dpkg-source: unpacking bash-completion_20060301.orig.tar.gz
dpkg-source: applying ./bash-completion_20060301-3.diff.gz
mika@arthur:~/bct$ grep -- --auto-remove bash-completion-20060301/bash_completion
                                --tar-only --config-file --option --auto-remove' -- $cur ) )

So it seems you have an outdated version of the script installed. Maybe you have edited the file yourself some time ago and now ucf cannot update the contents without overwriting your changes?

The latest version is installed in /usr/share/bash/bash_completion, so you might want to do:
$ diff -u /etc/bash_completion /usr/share/bash/bash_completion

And if there's nothing in your version that you want to keep, just:
$ sudo cp /usr/share/bash/bash_completion /etc/bash_completion

Revision history for this message
Nicolò Chieffo (yelo3) wrote :

Sorry, but this package is in universe and it is not installed by default

Revision history for this message
Mika Fischer (zoop) wrote :

That's correct. However if you have /etc/bash_completion but don't have the package bash-completion installed, then this is either a leftover from a previous release or you installed it yourself.

Either way, there's not much I can do about it.

The bash_completion script was separated from the bash package recently. So if you want to use it you should install bash-completion, otherwise you should remove the leftover /etc/bash_completion and just use the builtin bash completion.

Revision history for this message
Nicolò Chieffo (yelo3) wrote :

I have understood. But that's so strange that bash completion has been
removed from main to universe... do you know the motivation?

Revision history for this message
Mika Fischer (zoop) wrote :

Well, the main reason is that bash and bash-completion are separate projects. I think only Debian (and hence Ubuntu) included the bash_completion script directly in the bash package. And another thing is that bash_completion is essentially unmaintained upstream. So splitting the packages makes perfect sense.

Whether bash-completion should be in main is perhaps dabatable, but basic completion also works without it and it is by no means an essential tool (although convenient). So I think putting it into universe is also OK.

Revision history for this message
Jordan (jordanu) wrote :

I am using an up-to date hardy and it seems that the bash package still contains a /etc/bash_completion script:

$ dpkg -L bash | grep completion
/etc/bash_completion

Also, it seems that the bash_completion script from the bash-completion still does not deal with apt-get autoremove correctly in that:

apt-get autoremove firefo<tab>

Does nothing.

Revision history for this message
Mika Fischer (zoop) wrote :

Strange. Could you try the following and compare the results?

mika@arthur:~$ dpkg -L bash | grep bash_completion

mika@arthur:~(1)$ dpkg -L bash-completion | grep bash_completion
/etc/bash_completion.d
/usr/share/bash/bash_completion
/usr/share/doc/bash/README.bash_completion.gz

mika@arthur:~$ grep autoremove /usr/share/bash/bash_completion
                                build-dep check clean autoclean autoremove' \

mika@arthur:~$ dpkg -s bash | grep Version
Version: 3.2-0ubuntu15

mika@arthur:~$ dpkg -s bash-completion | grep Version
Version: 20060301-3ubuntu1

mika@arthur:~/tmp/bash-3.2$ cat /var/lib/dpkg/info/bash.conffiles
/etc/skel/.bashrc
/etc/skel/.profile
/etc/skel/.bash_logout
/etc/bash.bashrc

Revision history for this message
Nicolò Chieffo (yelo3) wrote :

autoremove does not accept any other parameters, you should use
--auto-remove if you want to add a package name!

Revision history for this message
Mika Fischer (zoop) wrote :

Ah, that's right, thanks!

So I think we can finally close this one. Please reopen if you still have problems

Changed in bash-completion:
assignee: doko → zoop
status: Incomplete → 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.