Re: Line ending issue when "Reading database"

2017-03-28 Thread Ian Jackson
Guillem Jover writes ("Re: Line ending issue when "Reading database""):
> On Tue, 2017-03-28 at 15:57:33 +0100, Ian Jackson wrote:
> > Would someone care to file a bug against apt, requesting that the
> > default be changed early in the buster cycle ?
> 
> This is definitely an intended feature. apt does that so that it can
> intercept the output and log it into the term.log file.

apt should certainly do this only if it has a controlling terminal,
and arguably only if the stderr is directed there.

It should not provide a controlling terminal to dpkg unless it had one
itself.

.oO{ Also if it does this, does it proxy all the stuff which a pty
wrapper needs to proxy? }

Ian.



Re: Line ending issue when "Reading database"

2017-03-28 Thread David Kalnischkies
On Tue, Mar 28, 2017 at 03:57:33PM +0100, Ian Jackson wrote:
> Sven Joachim writes ("Re: Line ending issue when "Reading database""):
> > One problem here is that there is currently no option for dpkg to
> > suppress the output entirely, see bug #539617[1].  The other one is that
> > apt always runs dpkg in a tty, unless an undocumented option is used[2].
> 
> I wasn't aware of that latter.  I think that is a bug in abpt.
> 
> Maybe once upon a time this was a reasonable workaround for ancient
> maintainer scripts, and the need to be able to run apt without a tty.
> But those days are long gone.
> 
> Would someone care to file a bug against apt, requesting that the
> default be changed early in the buster cycle ?

That "obviously" breaks all features which need apt to multiplex the
terminal rather than handing it of to dpkg (which hands it to debconf…)
including but not limited to /var/log/apt/term.log, a visual progress
bar, …

You can do without those in cron scripts and co probably as you might
(or might not) have other forms of logging in this area – and given that
there is no user interaction there is less need for logging (or more?).
As a default it is unsuitable through as humans like their shiny
progress bars (and some even logs).


The undocumented option is btw from 2013 introduced to help with testing
the case in which apt can't do the pseudo dance successfully (also,
tests involving dpkg output is harder for preciously the initial
problem).  It isn't really targeted for usage by the general public…
(Althrough we had it thankfully for the public as temporary workaround
at the time pseudo terminal handling ran hovac in the small differences
between linux and kfreebsd last time I pulled my hair out over trying to
work on that code)


Best regards

David Kalnischkies


signature.asc
Description: PGP signature


Re: Line ending issue when "Reading database"

2017-03-28 Thread Guillem Jover
Hi!

On Tue, 2017-03-28 at 15:57:33 +0100, Ian Jackson wrote:
> Sven Joachim writes ("Re: Line ending issue when "Reading database""):
> > One problem here is that there is currently no option for dpkg to
> > suppress the output entirely, see bug #539617[1].  The other one is that
> > apt always runs dpkg in a tty, unless an undocumented option is used[2].
> 
> I wasn't aware of that latter.  I think that is a bug in abpt.
> 
> Maybe once upon a time this was a reasonable workaround for ancient
> maintainer scripts, and the need to be able to run apt without a tty.
> But those days are long gone.
> 
> Would someone care to file a bug against apt, requesting that the
> default be changed early in the buster cycle ?

This is definitely an intended feature. apt does that so that it can
intercept the output and log it into the term.log file.

As Sven pointed out, dpkg should just have an option to control the
verbosity of its output, at various levels, one of which would to
simply remove "progress-bar" style reporting. It's something that
bothers me too, so I have it in mind, it's just work in progress,
as it "required" going over all still remaining output and wrapping
them over new functions. I think I'm only missing few now, so I'll
probably finish it up in buster.

Thanks,
Guillem



Re: Line ending issue when "Reading database"

2017-03-28 Thread Alexandre Detiste
2017-03-28 16:44 GMT+02:00 Sven Joachim :
>
> Adding "-o Dpkg::Use-Pty=0" to apt-get's commandline should at least get
> rid of the of the \r line breaks.
>
> Cheers,
>Sven
>

Hi,

I'll try to make unattended-upgrades make use of this option.
(almost same bug)

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=776753
 Greets,

Alexandre



Re: Line ending issue when "Reading database"

2017-03-28 Thread Ian Jackson
Sven Joachim writes ("Re: Line ending issue when "Reading database""):
> One problem here is that there is currently no option for dpkg to
> suppress the output entirely, see bug #539617[1].  The other one is that
> apt always runs dpkg in a tty, unless an undocumented option is used[2].

I wasn't aware of that latter.  I think that is a bug in abpt.

Maybe once upon a time this was a reasonable workaround for ancient
maintainer scripts, and the need to be able to run apt without a tty.
But those days are long gone.

Would someone care to file a bug against apt, requesting that the
default be changed early in the buster cycle ?

Ian.



Re: Line ending issue when "Reading database"

2017-03-28 Thread Sven Joachim
On 2017-03-28 15:06 +0100, Ian Jackson wrote:

> Craig Francis writes ("Line ending issue when "Reading database""):
>> When running `apt-get upgrade` via a cron job, there is a "Reading database"
>> section.
>> 
>> In the email this appears as:
> ...
>> It's not a major issue, as it just breaks DKIM signing of emails;
>> where the "\ r" is changed to a "\r\n" after the DKIM signature has
>> been added.
>> 
>> I've been informed by Julian Klode that this relates to `dpkg`:
>
> I think that these \r-terminated progress messages should be printed
> only when the destination is a tty.

One problem here is that there is currently no option for dpkg to
suppress the output entirely, see bug #539617[1].  The other one is that
apt always runs dpkg in a tty, unless an undocumented option is used[2].

Adding "-o Dpkg::Use-Pty=0" to apt-get's commandline should at least get
rid of the of the \r line breaks.

Cheers,
   Sven


1. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=539617
2. 
https://sources.debian.net/src/apt/1.4~rc2/apt-pkg/deb/dpkgpm.cc/?hl=1222#L1222



Re: Line ending issue when "Reading database"

2017-03-28 Thread Ian Jackson
Craig Francis writes ("Line ending issue when "Reading database""):
> When running `apt-get upgrade` via a cron job, there is a "Reading database"
> section.
> 
> In the email this appears as:
...
> It's not a major issue, as it just breaks DKIM signing of emails;
> where the "\ r" is changed to a "\r\n" after the DKIM signature has
> been added.
> 
> I've been informed by Julian Klode that this relates to `dpkg`:

I think that these \r-terminated progress messages should be printed
only when the destination is a tty.

Ian.