[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#874326: [PATCH 1/3] update: let `ListUpdate()` return false only if locking fails



No-one is looking at the return value of this function, but we'll start
doing that in the next commit, in order to stop further work if locking
fails. But we have several tests which actually expect us to continue if
`List.GetIndexes()` or `AcquireUpdate()` returns false, so let's first
make sure we don't propagate their return values.

Rather than returning a bool here, which forces us to separate "locking
error" from "any other problem, or success", we could return more
fine-grained information. But considering how no-one has looked at this
return value for many years, such more informational return values can
wait until we actually need them.
---
 apt-pkg/update.cc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/apt-pkg/update.cc b/apt-pkg/update.cc
index 4c64eeb5d..4458331b9 100644
--- a/apt-pkg/update.cc
+++ b/apt-pkg/update.cc
@@ -20,7 +20,9 @@ using namespace std;
 // ListUpdate - construct Fetcher and update the cache files		/*{{{*/
 // ---------------------------------------------------------------------
 /* This is a simple wrapper to update the cache. it will fetch stuff
- * from the network (or any other sources defined in sources.list)
+ * from the network (or any other sources defined in sources.list).
+ * The return value is false if we fail to get the lock, and true
+ * otherwise.
  */
 bool ListUpdate(pkgAcquireStatus &Stat, 
 		pkgSourceList &List, 
@@ -32,9 +34,10 @@ bool ListUpdate(pkgAcquireStatus &Stat,
 
    // Populate it with the source selection
    if (List.GetIndexes(&Fetcher) == false)
-	 return false;
+      return true;
 
-   return AcquireUpdate(Fetcher, PulseInterval, true);
+   AcquireUpdate(Fetcher, PulseInterval, true);
+   return true;
 }
 									/*}}}*/
 // AcquireUpdate - take Fetcher and update the cache files		/*{{{*/
-- 
2.21.0.rc2.5.gc65a2884ea


Reply to: