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. 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. My prefered solution would be to do like with Suggests-Will-Not-Install, that is, only show Recommended-Will-Not-Install if verbose>0 (as the patch from Ubuntu, but Daniel Burrows didn't like the solution, and I don't know why). Or alternatively, show it inconditionally (which probably users didn't like, and that's why Ubuntu implemented a solution). Opinions? -- Manuel A. Fernandez Montecelo <manuel.montez...@gmail.com>
diff --git a/src/cmdline/cmdline_prompt.cc b/src/cmdline/cmdline_prompt.cc index 25fadaa..7f417a5 100644 --- a/src/cmdline/cmdline_prompt.cc +++ b/src/cmdline/cmdline_prompt.cc @@ -702,7 +702,10 @@ bool cmdline_show_preview(bool as_upgrade, pkgset &to_install, } } - if(quiet == 0 && !recommended.empty()) + // mafm: see bug #720074, assuming that if stdout is not a tty the quiet + // option was automatic and does not apply for silencing this message + bool quiet_because_of_pipe_or_redirection = (quiet != 0) && !isatty(1); + if((quiet == 0 || quiet_because_of_pipe_or_redirection) && !recommended.empty()) { printf(_("The following packages are RECOMMENDED but will NOT be installed:\n")); cmdline_show_instinfo(recommended, verbose, showvers, showdeps, showsize, false, showwhy, term_metrics);