[Aptitude-devel] Bug#720074: Bug#647474: aptitude: When piping, stdout doesn't include "RECOMMENDED but will not be installed"

Daniel Hartwig mandyke at gmail.com
Sun Feb 9 06:29:19 UTC 2014


Control: tags -1 = confirmed
Control: owner -1 !

On 9 February 2014 09:05, Manuel A. Fernandez Montecelo
<manuel.montezelo at gmail.com> wrote:
> forcemerge 647474 720074
> severity 647474 minor
> owner 647474 !
> tags 647474 + patch moreinfo
> stop
>
> Hi,
>
> The problem was introduced here in 2007, after a feature request which
> was previously implemented in Ubuntu:
>
>   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=452202
>
>
> The basic problem is that showing the recommends in command line mode
> depends on the option "Quiet" (which can be set by "-q" in the command
> line, or "-o Quiet=integer").
>
> It turns out that in src/main.cc, this option is set up automatically
> to a positive number if the output is not a tty (the case of pipes or
> redirections), even if the user didn't request it through the command
> line explicitly:
>
>   int curr_quiet = aptcfg->FindI("quiet", 0);
>   if(seen_quiet)
>     aptcfg->SetNoUser("quiet", quiet);
>   if(quiet == 0 && !isatty(1))
>     aptcfg->SetNoUser("quiet", std::max(curr_quiet, 1));
>
>
> The code above cannot be "fixed", since the "progress" operations
> depend on this to work correctly.
>

The issues here are addressed adequately in wip-cmdline.



> I created the patch, attached.  The solution is not very good for my
> taste, but Daniel Burrows solved it in this way, attaching this
> message to the "Quiet" option (which doesn't happen for any other
> output than progress-like), so this is the quick and dirty fix chaning
> behaviour minimally and fixing this problem.
>
> I say minimally because I don't think that users will rely (and thus,
> complain if changes behaviour) on something as subtle as setting the
> option -q explicitly while using pipes/redirection for other reasons,
> to specifically avoid printing this message.
>

This presumes too much.  It is not possible to determine this
quiet_because_of_pipe_or_redirection at the point it is introduced,
using the test it does.  In any case, resolved in wip-cmdline.



More information about the Aptitude-devel mailing list