Debian Bug report logs - #539617
dpkg: Add option to suppress progress display while reading database

version graph

Package: dpkg; Maintainer for dpkg is Dpkg Developers <debian-dpkg@lists.debian.org>; Source for dpkg is src:dpkg.

Reported by: Frans Pop <elendil@planet.nl>

Date: Sun, 2 Aug 2009 11:57:01 UTC

Severity: wishlist

Found in version dpkg/1.15.3.1

Blocking fix for 537333: aptitude: Option -q doesn't turn off progress indicator, 569515: -o option to eliminate progress indicators

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#539617; Package dpkg. (Sun, 02 Aug 2009 11:57:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Frans Pop <elendil@planet.nl>:
New Bug report received and forwarded. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Sun, 02 Aug 2009 11:57:03 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Frans Pop <elendil@planet.nl>
To: Debian BTS Submit <submit@bugs.debian.org>
Subject: dpkg: Add option to suppress progress display while reading database
Date: Sun, 2 Aug 2009 13:54:24 +0200
[Message part 1 (text/plain, inline)]
Package: dpkg
Version: 1.15.3.1
Severity: wishlist
Tags: patch

When the output of package installations are logged to a file, the 
progress counter updates while reading the database are distracting.

This is especially the case in Debian Installer where multiple package 
installations are started and all are logged to the syslog. For an 
example of the result, see the syslog attached in [1].

Another example is buildd logs, for example [2].

The attached patch adds an option --no-db-progress that allows to suppress 
the progress updates in such situations.

If you'd like any changes (maybe a more generic name for the option?) or 
if I've forgotten anything, then please let me know.

The patch is based on current git:
commit 173652e75fad004c42906608fe0ff4556be29b19
Author: Helge Kreutzmann <debian@helgefjell.de>
Date:   Thu Jul 30 18:38:57 2009 +0200
    Fix errors in a paragraph in the German man page translation.

[1]http://bugs.debian.org/538344#15 (see lines starting at 00:26:43)
[2]https://buildd.debian.org/fetch.cgi?pkg=clock-setup&arch=i386&ver=0.99&stamp=1249206304&file=log&as=raw
[dpkg_no-db-progress.patch (text/x-diff, inline)]
diff --git a/man/dpkg.1 b/man/dpkg.1
index 665519f..e925a2e 100644
--- a/man/dpkg.1
+++ b/man/dpkg.1
@@ -556,6 +556,10 @@ may leave packages in the improper \fBtriggers\-awaited\fP and
 .TP
 \fB\-\-triggers\fP
 Cancels a previous \fB\-\-no\-triggers\fP.
+.TP
+\fB\-\-no-db-progress\fP
+Do not report progress while reading database. This can be useful when
+logging the output of dpkg to a file.
 .
 .SH FILES
 .TP
diff --git a/src/filesdb.c b/src/filesdb.c
index da8cde2..dc0bfad 100644
--- a/src/filesdb.c
+++ b/src/filesdb.c
@@ -219,21 +219,25 @@ void ensure_allinstfiles_available(void) {
     int max = countpackages();
 
     saidread=1;
-    progress_init(&progress, _("(Reading database ... "), max);
+    if (!f_nodbprogr)
+      progress_init(&progress, _("(Reading database ... "), max);
+    else
+      printf(_("(Reading database ... "));
   }
 
   it= iterpkgstart();
   while ((pkg = iterpkgnext(it)) != NULL) {
     ensure_packagefiles_available(pkg);
 
-    if (saidread == 1)
+    if (!f_nodbprogr && saidread == 1)
       progress_step(&progress);
   }
   iterpkgend(it);
   allpackagesdone= 1;
 
   if (saidread==1) {
-    progress_done(&progress);
+    if (!f_nodbprogr)
+      progress_done(&progress);
     printf(_("%d files and directories currently installed.)\n"),nfiles);
     saidread=2;
   }
diff --git a/src/main.c b/src/main.c
index ad9b4b8..6a5fed8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -136,6 +136,7 @@ usage(void)
 "  --no-force-...|--refuse-...\n"
 "                             Stop when problems encountered.\n"
 "  --abort-after <n>          Abort after encountering <n> errors.\n"
+"  --no-db-progress           Do not report progress while reading database.\n"
 "\n"), ADMINDIR) < 0) werr ("stdout");
 
   if (fprintf (stdout, _(
@@ -164,7 +165,7 @@ const char printforhelp[]= N_(
 
 const struct cmdinfo *cipaction = NULL;
 int f_pending=0, f_recursive=0, f_alsoselect=1, f_skipsame=0, f_noact=0;
-int f_autodeconf=0, f_nodebsig=0;
+int f_autodeconf=0, f_nodebsig=0, f_nodbprogr=0;
 int f_triggers = 0;
 unsigned long f_debug=0;
 /* Change fc_overwrite to 1 to enable force-overwrite by default */
@@ -442,6 +443,7 @@ static const struct cmdinfo cmdinfos[]= {
   { "selected-only",     'O', 0, &f_alsoselect, NULL,      NULL,    0 },
   { "triggers",           0,  0, &f_triggers,   NULL,      NULL,    1 },
   { "no-triggers",        0,  0, &f_triggers,   NULL,      NULL,   -1 },
+  { "no-db-progress",     0,  0, &f_nodbprogr,  NULL,      NULL,    1 },
   /* FIXME: Remove ('N') sometime. */
   { "no-also-select",    'N', 0, &f_alsoselect, NULL,      NULL,    0 },
   { "skip-same-version", 'E', 0, &f_skipsame,   NULL,      NULL,    1 },
diff --git a/src/main.h b/src/main.h
index cd8c7b6..d235ed4 100644
--- a/src/main.h
+++ b/src/main.h
@@ -84,7 +84,7 @@ extern const char *const statusstrings[];
 
 extern const struct cmdinfo *cipaction;
 extern int f_pending, f_recursive, f_alsoselect, f_skipsame, f_noact;
-extern int f_autodeconf, f_nodebsig;
+extern int f_autodeconf, f_nodebsig, f_nodbprogr;
 extern int f_triggers;
 extern unsigned long f_debug;
 extern int fc_downgrade, fc_configureany, fc_hold, fc_removereinstreq, fc_overwrite;
diff --git a/src/query.c b/src/query.c
index 48eacc0..2d06446 100644
--- a/src/query.c
+++ b/src/query.c
@@ -492,7 +492,7 @@ Use --license for copyright license and lack of warranty (GNU GPL).");
 
 const struct cmdinfo *cipaction = NULL;
 int f_pending=0, f_recursive=0, f_alsoselect=1, f_skipsame=0, f_noact=0;
-int f_autodeconf=0, f_nodebsig=0;
+int f_autodeconf=0, f_nodebsig=0, f_nodbprogr=0;
 unsigned long f_debug=0;
 /* Change fc_overwrite to 1 to enable force-overwrite by default */
 int fc_hold=0;

Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#539617; Package dpkg. (Sun, 02 Aug 2009 16:12:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Guillem Jover <guillem@debian.org>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Sun, 02 Aug 2009 16:12:06 GMT) Full text and rfc822 format available.

Message #10 received at 539617@bugs.debian.org (full text, mbox):

From: Guillem Jover <guillem@debian.org>
To: Frans Pop <elendil@planet.nl>, 539617@bugs.debian.org
Subject: Re: Bug#539617: dpkg: Add option to suppress progress display while reading database
Date: Sun, 2 Aug 2009 17:33:25 +0200
Hi!

On Sun, 2009-08-02 at 13:54:24 +0200, Frans Pop wrote:
> Package: dpkg
> Version: 1.15.3.1
> Severity: wishlist
> Tags: patch
> 
> When the output of package installations are logged to a file, the 
> progress counter updates while reading the database are distracting.

It should only get updated if stdout is a tty. In the same way most other
programs do it, including apt for example.

> This is especially the case in Debian Installer where multiple package 
> installations are started and all are logged to the syslog. For an 
> example of the result, see the syslog attached in [1].
> 
> Another example is buildd logs, for example [2].

I'm guessing this logging is taken from the tty directly instead of
redirecting stdout? If so, OOC what was the reason to do it that way?

Also you'll notice that in normal conditions this works just fine,
see 00:10:32, 00:10:39, etc. And when it does not work (on in-target) it
does not work only for dpkg but for other stuff as well, see 01:12:27.

On the build logs the same happens, some parts work ok, others not, I'm
guessing a similar issue with not just redirecting stdout.

> The attached patch adds an option --no-db-progress that allows to suppress 
> the progress updates in such situations.
> 
> If you'd like any changes (maybe a more generic name for the option?) or 
> if I've forgotten anything, then please let me know.

Hmm, this options is too specific, and I'd like dpkg to automatically do
the right thing, OTOH most apps do fancier stuff when they know they are
running on a tty, and if one reads from the tty directly it's expected
to get garbage. That does not mean we could not add something like a
--quiet option, though, but I'd rather understand first what and why
of the current situation.

regards,
guillem




Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#539617; Package dpkg. (Sun, 02 Aug 2009 16:18:19 GMT) Full text and rfc822 format available.

Acknowledgement sent to Julien Cristau <jcristau@debian.org>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Sun, 02 Aug 2009 16:18:19 GMT) Full text and rfc822 format available.

Message #15 received at 539617@bugs.debian.org (full text, mbox):

From: Julien Cristau <jcristau@debian.org>
To: Frans Pop <elendil@planet.nl>, 539617@bugs.debian.org
Subject: Re: Bug#539617: dpkg: Add option to suppress progress display while reading database
Date: Sun, 2 Aug 2009 17:48:07 +0200
On Sun, Aug  2, 2009 at 13:54:24 +0200, Frans Pop wrote:

> When the output of package installations are logged to a file, the 
> progress counter updates while reading the database are distracting.
> 
> This is especially the case in Debian Installer where multiple package 
> installations are started and all are logged to the syslog. For an 
> example of the result, see the syslog attached in [1].
> 
> Another example is buildd logs, for example [2].
> 
As far as I can tell, progress_step() isn't supposed to do anything if
stdout isn't a tty.  I'd expect that to be the case for buildd logs, at
least (don't know how this is handled by d-i).

Cheers,
Julien




Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#539617; Package dpkg. (Sun, 02 Aug 2009 16:18:39 GMT) Full text and rfc822 format available.

Acknowledgement sent to Frans Pop <elendil@planet.nl>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Sun, 02 Aug 2009 16:18:39 GMT) Full text and rfc822 format available.

Message #20 received at 539617@bugs.debian.org (full text, mbox):

From: Frans Pop <elendil@planet.nl>
To: 539617@bugs.debian.org
Subject: Re: Bug#539617: dpkg: Add option to suppress progress display while reading database
Date: Sun, 2 Aug 2009 18:05:21 +0200
Hi Guillem,

On Sunday 02 August 2009, Guillem Jover wrote:
> I'm guessing this logging is taken from the tty directly instead of
> redirecting stdout? If so, OOC what was the reason to do it that way?

The reason is that we're running in a fairly complex environment there. 
We're installing in a chroot and getting progress info through debconf, 
with debconf info being passed from debconf in the chroot to cdebconf in 
the D-I environment. So we already have endless fun redirections.

A program called log-output is used to do the eventual logging.

See debian-installer-utils [1] if you'd like to have a look at them.
A typical installation of a single package would use first apt-install, 
which calls apt-get (through debconf-apt-progress with various options) 
using in-target, which in turn sources chroot-setup.sh and uses 
log-output...
At some point we also call tasksel, but the principle remains the same.

So, it's not all that strange that dpkg isn't able to tell where the 
output ends up in the end. Colin Watson will be better able than me to 
really explain the intricacies.

> Also you'll notice that in normal conditions this works just fine,
> see 00:10:32, 00:10:39, etc.

Yes, that's debootstrap which runs in a very different environment (though 
also with a D-I wrapper).

> And when it does not work (on in-target) it does not work only for dpkg
> but for other stuff as well, see 01:12:27.

True and it would be nice to get rid of that as well, but there's quite a 
difference between 4 and 20 lines :-)

> > If you'd like any changes (maybe a more generic name for the option?)
> > or if I've forgotten anything, then please let me know.
>
> Hmm, this options is too specific, and I'd like dpkg to automatically
> do the right thing, OTOH most apps do fancier stuff when they know they
> are running on a tty, and if one reads from the tty directly it's
> expected to get garbage. That does not mean we could not add something
> like a --quiet option, though, but I'd rather understand first what and
> why of the current situation.

Yeah, I already thought you might prefer something like that. A 
general --quiet option would be fine with me as long as we don't lose any 
of the "real" info needed to debug installation failures.

Thanks,
FJP

[1]http://svn.debian.org/wsvn/d-i/trunk/packages/debian-installer-utils/#_trunk_packages_debian-installer-utils_




Added indication that bug 539617 blocks537333 Request was from Sven Joachim <svenjoac@gmx.de> to control@bugs.debian.org. (Wed, 05 Aug 2009 07:00:05 GMT) Full text and rfc822 format available.

Removed indication that bug 539617 blocks Request was from Sven Joachim <svenjoac@gmx.de> to control@bugs.debian.org. (Wed, 05 Aug 2009 09:54:11 GMT) Full text and rfc822 format available.

Added indication that bug 539617 blocks 537333,569515 Request was from Julian Andres Klode <jak@debian.org> to control@bugs.debian.org. (Fri, 12 Feb 2010 11:51:09 GMT) Full text and rfc822 format available.

Removed tag(s) patch. Request was from Raphaël Hertzog <hertzog@debian.org> to control@bugs.debian.org. (Thu, 06 May 2010 13:33:16 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Apr 19 15:47:06 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.