Bug#823534: apt-get remove is unhelpful for virtual packages
Hi,
* Richard Stallman [2016-05-05 14:48 -0400]:
> Package: apt
> Version: 1.0.1ubuntu2.13+7.0trisquel3
>
> I tried to remove a package which is virtual, specifically nethack.
> apt-get told me it could not do this, but said nothing about
> what to do.
"apt-cache showpkg mail-transport-agent" lists "Reverse Provides:",
but it does not show which m-t-a is installed. Maybe this is worth
an additional bug report?
> It would surely be easy to make it handle a virtual package by
> seeing which real package provides it, and offering to delete
> that one.
I see three possible ways to address this issue:
1. Offering to delete the real package, as rms wrote. apt-get
would then, for instance, ask "... Would you like to remove
postfix instead? [yN]".
This might or might not be useful for /usr/bin/apt, but I hope
apt-get will stay as non-interactive as it has always been.
2. Provide a more useful output. A good example is the output of
apt-get _install_ virtual-package on jessie:
# apt-get install mail-transport-agent
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package mail-transport-agent is a virtual package provided by:
opensmtpd 5.7.3p2-1
...
exim4-daemon-heavy 4.84.2-1
You should explicitly select one to install.
E: Package 'mail-transport-agent' has no installation candidate
3. "Do What I Mean" (DWIM) - on IRC, it has been suggested to remove
the real package if there is only one provider.
Assume that the packages foo and bar are installed, that foo is not
available via an apt repository anymore, and that bar provides foo.
"apt-get remove foo" would then remove foo the first time
it is run and it would remove bar the second time it is run.
I wouldn't consider this to be an intuitive behaviour.
At least I try to remove packages I removed previously from time
to time (although I know that I already removed them). And I don't
think I'm the only one who occasionally runs "apt-get install pkg1
pkg2- pkg3-", and then presses the up key and appends additional
package names in order to save some key presses.
> Alas. I can't reproduce this now, or show you the output,
> because I no longer have those packages installed.
On stable, the according output is:
# apt-get remove mail-transport-agent
Reading package lists... Done
Building dependency tree
Reading state information... Done
Virtual packages like 'mail-transport-agent' can't be removed
The following packages were automatically installed ...
I noticed that the 'Virtual packages ...' line vanishes if stdout is
piped through, e.g., cat and wonder if this is done deliberately.
Regards
Carsten
Reply to: