[Aptitude-devel] Bug #498239: aptitude: warnings, status printed twice

Daniel Hartwig mandyke at gmail.com
Fri Feb 28 15:48:34 UTC 2014

user debian-qa at lists.debian.org
usertag 498239 - gift

On 28 February 2014 02:26, Boris Egorov <jightuse at gmail.com> wrote:
> Hello folks.


Thanks for your interest and patch.  You have dived in to some of the
hairiest parts of the program here :-)

> I found a problem which triggers bug #498239. You can see it in
> src/cmdline/cmdline_do_action.cc:307 or at this long path:
> https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=aptitude/aptitude.git;a=blob;f=src/cmdline/cmdline_do_action.cc;h=8d0883797daee17666eb63f253e65bd841409c74;hb=0a2795f113e2588fc4c6b4091cf32ccff49e4974#l307
> We do a two runs over all the packages if we have auto-install turned on
> (see comment). So we call function cmdline_applyaction from
> src/cmdline/cmdline_action.cc:221 twice (if we have one action as in bug
> inputs). This function at line 375 and overloaded one at line 582 triggers
> the bug.
> How it should be fixed?

> All overloaded functions cmdline_applyaction has
> argument allow_auto which set to true if current iteration is not first.

This is not true, the function is also called with allow_auto=true
(via cmdline_parse_action) in cmdline_prompt.cc, and this is unrelated
to the two-pass algorithm used in cmdline_do_action.

> I
> think we can not to print warnings if allow_auto is true. What do you think?

No, your suggestion goes beyond the intent of allow_auto.

The structure of this set of functions is at fault here; basically,
cmdline_applyaction takes on too much functionality and should be
split.  Selection of packages from cmdline arguments needs to happen
independently of applying the action to the packages.  The two-pass
should happen after package selection, as that part need not be
repeated, and the warnings about not found packages etc. are generated
during selection.  You can see this algorithm implemented in
apt-get.cc and will be integrated soon as part of a major
restructuring of the cmdline module in aptitude.

> Sorry if I'm doing something wrong, I haven't contributed to debian before.
> I found the bug thanks to how-can-i-help and want to fix it.

Not at all.  I hope you will consider tackling some other bugs in aptitude.

I am the one who applied the gift (how-can-i-help) tag to this bug,
and seem to have forgotten about it since then.  Removing them now as
this is no longer an interesting issue to work on.


Daniel Hartwig

More information about the Aptitude-devel mailing list