Re: Bug#579790: apt: should use selections instead of --force-* options
Control: reassign -1 apt
Control: retitle -1 apt: should use selections instead of --force-* options
[ This is actually something I've had in my list of things to discuss
with frontends, so here it goes, through a bug report. :) ]
On Sat, 2010-07-17 at 06:59:38 -0500, Jonathan Nieder wrote:
> Moritz Beyreuther wrote:
> > /usr/bin/dpkg --status-fd 11 --force-depends --force-remove-essential --remove courier-mta courier-base courier-authdaemon courier-authlib-userdb courier-authlib
> >
> > However courier-authlib is deinstalled first which breaks the
> > deinstallation process as explained in 579790.
>
> exim is being installed to replace courier-mta as mail-transfer-agent.
> As you mentioned, bsd-mailx depends on an mta, so there is apparently
> no clean way to do this and the frontend passes a --force-* option.
> So now from the point of view of dpkg we are outside the realm of
> policy and in my opinion no matter what happens it is not going to be
> intuitive.
>
> There is a way around that, which is to use the --auto-deconfigure
> option. It should be able to produce a saner sequence of operations:
>
> 1. deconfigure everything that needs an mta
> 2. remove courier-mta
> 3. remove the packages courier-mta depended on
Nope, the correct way to go about this is to setup a “dpkg transaction”
through selections, which tells explicitly to dpkg what can be done,
avoids the extra scary message from dpkg, gets a better result,
minimizes the time packages have been forced out of the way, and
avoids --force-* options.
In this case apt would do, the equivalent of:
# cat <<TRANS | dpkg --set-selections
courier-mta deinstall
courier-base deinstall
courier-authdaemon deinstall
courier-authlib-userdb deinstall
courier-authlib deinstall
TRANS
# dpkg --auto-deconfigure --install exim*.deb
# dpkg --remove --pending
or something similar. In general apt should really not be forcing
removals on dpkg, it should tell dpkg what packages are fine to
remove, and then do a final remove, that would also reduce the number
of transactions needed for an upgrade.
The only --force option that a frontend should be “justified” to use
at all is --force-remove-essential, only when the user has acknowledged
that explicitly through a prompt or similar, and only then, not passed
blindly on all invocations.
In general, any time a frontend is using a --force option, there's
something wrong going on.
Using selections is how dselect has managed to work all this time w/o
the need for any --force option at all.
Thanks,
Guillem
Reply to: