#776753 unattended-upgrades: dpkg log extraneously include progress indicator

#776753#5
Date:
2015-02-01 11:09:25 UTC
From:
To:
Dear Maintainer,

dpkg log erroneously include dpkg progress indicator;
this is maybe a bug in python3-apt.

I have found a way to get rid of those lines;
but this is not a proper fix;
and only work with my current locale:

                 if stanza_start >= install_start_time:
                     found_start = True
-            if found_start:
+            if found_start and not line.startswith('(Lecture de la base de données...'):
                 content.append(line)

problem also found on 0.83.3, but hidden by other bug #776752
-----

Journal d'installation du paquet :
Log started: 2015-01-25  06:23:23
(Lecture de la base de données...
(Lecture de la base de données... 5%
(Lecture de la base de données... 10%
(Lecture de la base de données... 15%
(Lecture de la base de données... 20%
(Lecture de la base de données... 25%
(Lecture de la base de données... 30%
(Lecture de la base de données... 35%
(Lecture de la base de données... 40%
(Lecture de la base de données... 45%
(Lecture de la base de données... 50%
(Lecture de la base de données... 55%
(Lecture de la base de données... 60%
(Lecture de la base de données... 65%
(Lecture de la base de données... 70%
(Lecture de la base de données... 75%
(Lecture de la base de données... 80%
(Lecture de la base de données... 85%
(Lecture de la base de données... 90%
(Lecture de la base de données... 95%
(Lecture de la base de données... 100%
(Lecture de la base de données... 52655 fichiers et répertoires déjà installés.)
Préparation du dépaquetage de .../libicu52_52.1-7_armhf.deb ...

#776753#16
Date:
2015-02-04 12:07:35 UTC
From:
To:
Thanks for your bugreport.

[..]
[..]

I can not reproduce this on my workstation, I don't have a raspi here
right now to test it against that. Do you see this on a "normal" sid
also or is this specific to the package set for the raspi?

Thanks,
 Michael

#776753#21
Date:
2015-02-04 13:09:01 UTC
From:
To:
This is not Raspi specific at all.
The only think modified by their patch is the default configuration file.

I thought it was because of 'Dpkg::Progress-Fancy "1";'
as advertised, but it doesn't seem to be the case.

Maybe it's because I use systemd-cron instead of cron
and the tty or environment is not set the same way
and then dpkg or it's python wrapper doesn't know it
shouldn't display a progress bar.

#776753#26
Date:
2015-02-04 14:27:18 UTC
From:
To:
Thanks! That sounds plausible, if systemd-cron runs the jobs inside a
pty that explains what you see. Is this the case? If so I will have to
think a bit what can be done, probably involves some poking at the
dpkg source code to figure out if there is a config switch or a
environment variable to stop dpkg from showing this progress.

Thanks,
 Michael

#776753#31
Date:
2015-02-04 22:16:50 UTC
From:
To:
dpkg just does "isatty(1)", nothing fancy
http://anonscm.debian.org/cgit/dpkg/dpkg.git/tree/lib/dpkg/progress.c

"systemd-run unattended-upgrades" will show the same behaviour,
without needing to install systemd-cron. (this create a one-time service)

I tried various tests, and isatty(1) allways returned the expected value.

I can't find why isatty(1) doesn't work when called from u-u.

#include <unistd.h>
#include <stdio.h>
int main()
{
  printf("isatty(stdout) = %d\n", isatty(1));
  fprintf(stderr, "isatty(stderr) = %d\n", isatty(1));
  return 0;
}

root@antec:/home/tchet# ./a.out
isatty(stdout) = 1
isatty(stderr) = 1
root@antec:/home/tchet# ./a.out > /dev/null
isatty(stderr) = 0
root@antec:/home/tchet# ./a.out | cat
isatty(stdout) = 0
isatty(stdout) = 0

#776753#36
Date:
2015-02-04 23:17:57 UTC
From:
To:
Ok, 776753 is the same bug as this one:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=539617

#776753#41
Date:
2015-09-16 13:43:14 UTC
From:
To:
Hi,

It's not clear to me that this problem is the
same as bug#539617.  For one thing I'm seeing
this problem occur only after upgrading to jessie.

I'm using systemd and running plain old cron,
or at least plain old cron is installed, and I'm
getting progress messages from aptitude run from
cron that I did not get under wheezy.  (For
example output see bug#795396.)

So, something has changed between wheezy
and jessie, but bug#539617 is far older.

Regards,

Karl <kop@meme.com>
Free Software:  "You don't pay back, you pay forward."
                 -- Robert A. Heinlein