Debian Bug report logs - #778357
audit 'apt-get update' exit codes

Package: apt; Maintainer for apt is APT Development Team <deity@lists.debian.org>; Source for apt is src:apt (PTS, buildd, popcon).

Reported by: Patrick Schleizer <adrelanos@riseup.net>

Date: Sat, 14 Feb 2015 00:45:02 UTC

Severity: important

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, holger@layer-acht.org, pabs@debian.org, APT Development Team <deity@lists.debian.org>:
Bug#778357; Package apt. (Sat, 14 Feb 2015 00:45:06 GMT) (full text, mbox, link).


Acknowledgement sent to Patrick Schleizer <adrelanos@riseup.net>:
New Bug report received and forwarded. Copy sent to holger@layer-acht.org, pabs@debian.org, APT Development Team <deity@lists.debian.org>. (Sat, 14 Feb 2015 00:45:06 GMT) (full text, mbox, link).


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

From: Patrick Schleizer <adrelanos@riseup.net>
To: submit@bugs.debian.org
Subject: audit 'apt-get update' exit codes
Date: Sat, 14 Feb 2015 00:40:43 +0000
Package: apt
Severity: important
X-Debbugs-CC: holger@layer-acht.org,pabs@debian.org

When "apt-get update" fails the program under some conditions exits with
a 0 status. It would be useful if it exited with a non-zero status in
that case (or if there were a switch to tell it to do so).

Since there is already...

- provide meaningful exit codes for network failures
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=776152

and

- apt: Provide meaningful exit codes for gpg failures
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=745735

That have been found more or less by trial and error... I am wondering,
if there are any other situations, where this could happen.

Perhaps while you're at #776152 and #745735, could you please check if
there are other cases, where apt-get exits with a 0 status, where it
should exit with a non-zero status?

Cheers,
Patrick



Information forwarded to debian-bugs-dist@lists.debian.org, APT Development Team <deity@lists.debian.org>:
Bug#778357; Package apt. (Sat, 14 Feb 2015 10:12:05 GMT) (full text, mbox, link).


Acknowledgement sent to Julian Andres Klode <jak@debian.org>:
Extra info received and forwarded to list. Copy sent to APT Development Team <deity@lists.debian.org>. (Sat, 14 Feb 2015 10:12:05 GMT) (full text, mbox, link).


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

From: Julian Andres Klode <jak@debian.org>
To: Patrick Schleizer <adrelanos@riseup.net>, 778357@bugs.debian.org
Subject: Re: Bug#778357: audit 'apt-get update' exit codes
Date: Sat, 14 Feb 2015 11:08:02 +0100
[Message part 1 (text/plain, inline)]
Am 14.02.2015 01:45 schrieb "Patrick Schleizer" <adrelanos@riseup.net>:
>
> Package: apt
> Severity: important
> X-Debbugs-CC: holger@layer-acht.org,pabs@debian.org
>
> When "apt-get update" fails the program under some conditions exits with
> a 0 status. It would be useful if it exited with a non-zero status in
> that case (or if there were a switch to tell it to do so).
>
> Since there is already...
>
> - provide meaningful exit codes for network failures
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=776152
>
> and
>
> - apt: Provide meaningful exit codes for gpg failures
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=745735
>
> That have been found more or less by trial and error... I am wondering,
> if there are any other situations, where this could happen.
>
> Perhaps while you're at #776152 and #745735, could you please check if
> there are other cases, where apt-get exits with a 0 status, where it
> should exit with a non-zero status?
>
> Cheers,
> Patrick

The results are meaningful. 0 indicates success or transient error, whereas
other values indicate a persistent error.

Stuff like gpg errors are transient, they are expected to happen during
mirror updates due to the repository format.
[Message part 2 (text/html, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, APT Development Team <deity@lists.debian.org>:
Bug#778357; Package apt. (Sun, 15 Feb 2015 02:45:05 GMT) (full text, mbox, link).


Acknowledgement sent to Patrick Schleizer <adrelanos@riseup.net>:
Extra info received and forwarded to list. Copy sent to APT Development Team <deity@lists.debian.org>. (Sun, 15 Feb 2015 02:45:05 GMT) (full text, mbox, link).


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

From: Patrick Schleizer <adrelanos@riseup.net>
To: Julian Andres Klode <jak@debian.org>, 778357@bugs.debian.org
Subject: Re: Bug#778357: audit 'apt-get update' exit codes
Date: Sun, 15 Feb 2015 02:43:15 +0000
Julian Andres Klode:
> The results are meaningful. 0 indicates success or transient error, whereas
> other values indicate a persistent error.
> 
> Stuff like gpg errors are transient, they are expected to happen during
> mirror updates due to the repository format.

If an adversary mounts a denial of service, indefinite freeze or
rollback attack, the error (network or gpg failure) would not be
transient, but persistent.




Information forwarded to debian-bugs-dist@lists.debian.org, APT Development Team <deity@lists.debian.org>:
Bug#778357; Package apt. (Wed, 09 May 2018 11:18:03 GMT) (full text, mbox, link).


Acknowledgement sent to Philipp Kern <pkern@debian.org>:
Extra info received and forwarded to list. Copy sent to APT Development Team <deity@lists.debian.org>. (Wed, 09 May 2018 11:18:03 GMT) (full text, mbox, link).


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

From: Philipp Kern <pkern@debian.org>
To: Julian Andres Klode <jak@debian.org>, 778357@bugs.debian.org
Cc: Patrick Schleizer <adrelanos@riseup.net>
Subject: Re: Bug#778357: audit 'apt-get update' exit codes
Date: Wed, 9 May 2018 13:15:23 +0200
On Sat, Feb 14, 2015 at 11:08:02AM +0100, Julian Andres Klode wrote:
> Am 14.02.2015 01:45 schrieb "Patrick Schleizer" <adrelanos@riseup.net>:
> > When "apt-get update" fails the program under some conditions exits with
> > a 0 status. It would be useful if it exited with a non-zero status in
> > that case (or if there were a switch to tell it to do so).
> >
> > Since there is already...
> >
> > - provide meaningful exit codes for network failures
> > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=776152
> >
> > and
> >
> > - apt: Provide meaningful exit codes for gpg failures
> > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=745735
> >
> > That have been found more or less by trial and error... I am wondering,
> > if there are any other situations, where this could happen.
> >
> > Perhaps while you're at #776152 and #745735, could you please check if
> > there are other cases, where apt-get exits with a 0 status, where it
> > should exit with a non-zero status?
> The results are meaningful. 0 indicates success or transient error, whereas
> other values indicate a persistent error.
> 
> Stuff like gpg errors are transient, they are expected to happen during
> mirror updates due to the repository format.

So I really struggle with this assertion. Without any alternative mode
this behavior makes it hard to use "apt-get update" reliabily from
scripts. Sure, if you are doing an update run in the background, this
might be fine. But returning 0 on a failing update is bad: for one you
cannot just retry transient failures because you would need to check for
non-empty stderr. Also if you expect your script to fail rather than to
continue with bad input (because it's set -e), it does not. Something
else might fail or you just include the wrong output into your disk
image like in my case today.

So pretty please, could we get a mode that is less surprising, in case
you still don't want to change the default? :)

Kind regards and thanks
Philipp Kern



Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Fri Jul 27 06:07:55 2018; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.