Bug#680997: python-apt: Acquire.run returns 0 even in case of download error
Control: tag -1 pending
On Mon, Jul 09, 2012 at 09:36:21PM +0200, Jakub Wilk wrote:
> Package: python-apt
> Version: 0.8.6
>
> apt_pkg.Acquire.run returns 0 (== RESULT_CONTINUE), even when some items
> failed to be downloaded. This is contrary to the documentation, which reads
> "RESULT_CONTINUE means that all items which where queued prior to calling
> run() have been fetched successfully."
>
> $ python test.py
> Err non-existent
> 404 Not Found [IP: 82.195.75.97 80]
> Fetched 0 B in 0s (0 B/s)
> .run() returned 0
Hi,
thanks for your bug report. I have fixed this in git by documenting
the behaviour: If run() returns 0, items may still have transient
errors.
There's no way we could change the behavior of run().
>From a6e3d4d872b852de308f19a15215180cb4116765 Mon Sep 17 00:00:00 2001
From: Julian Andres Klode <jak@debian.org>
Date: Wed, 10 Jun 2015 23:13:58 +0200
Subject: [PATCH] Acquire: Document that items may have transient errors on
run() success
If run() succeeded, items may still have transient errors, like a
Not Found error.
Closes: #680997
---
doc/source/library/apt_pkg.rst | 8 ++++++--
python/acquire.cc | 9 +++++----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst
index 5ccb93a..7a69059 100644
--- a/doc/source/library/apt_pkg.rst
+++ b/doc/source/library/apt_pkg.rst
@@ -1599,8 +1599,12 @@ installation.
.. attribute:: RESULT_CONTINUE
- All items have been fetched successfully and the process has not been
- canceled.
+ All items have been fetched successfully or failed transiently
+ and the process has not been canceled.
+
+ You need to look at the status of each item and check if it has not
+ failed transiently to discover errors like a Not Found when acquiring
+ packages.
.. attribute:: RESULT_FAILED
diff --git a/python/acquire.cc b/python/acquire.cc
index 82968a9..621f0ee 100644
--- a/python/acquire.cc
+++ b/python/acquire.cc
@@ -244,10 +244,11 @@ static PyObject *PkgAcquireShutdown(PyObject *Self,PyObject *Args)
static PyMethodDef PkgAcquireMethods[] = {
{"run",PkgAcquireRun,METH_VARARGS,
"run() -> int\n\nRun the fetcher and return one of RESULT_CANCELLED,\n"
- "RESULT_CONTINUE, RESULT_FAILED. RESULT_CONTINUE means that all items\n"
- "which where queued prior to calling run() have been fetched\n"
- "successfully. RESULT_CANCELLED means that the process was canceled\n"
- "by the progress class. And RESULT_FAILED means a generic failure."},
+ "RESULT_CONTINUE, RESULT_FAILED.\n\n"
+ "RESULT_CONTINUE means that all items which where queued prior to\n"
+ "calling run() have been fetched successfully or failed transiently.\n\n"
+ "RESULT_CANCELLED means canceled by the progress class.\n\n"
+ "RESULT_FAILED means a generic failure."},
{"shutdown",PkgAcquireShutdown, METH_VARARGS,
"shutdown()\n\n"
"Shut the fetcher down, removing all items from it. Future access to\n"
--
2.1.4
--
Julian Andres Klode - Debian Developer, Ubuntu Member
See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.
Be friendly, do not top-post, and follow RFC 1855 "Netiquette".
- If you don't I might ignore you.
Reply to: