[Aptitude-svn-commit] r4300 - in branches/aptitude-0.3/aptitude: . src

Daniel Burrows dburrows at costa.debian.org
Mon Sep 26 21:41:44 UTC 2005


Author: dburrows
Date: Mon Sep 26 21:41:41 2005
New Revision: 4300

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/download.cc
Log:
Don't crash if the package cache isn't available when we try to do an update.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Mon Sep 26 21:41:41 2005
@@ -1,5 +1,12 @@
 2005-09-26  Daniel Burrows  <dburrows at debian.org>
 
+	* src/download.cc:
+
+	  If the user tries to start a download while the package cache is
+	  NULL, print a cryptic error message instead of crashing.  If the
+	  user tries to start an update while the package cache is NULL,
+	  do the update instead of crashing.  (Closes: #309445)
+
 	* src/cmdline/cmdline_moo.cc:
 
 	  Delete the text at the end, which not only lacks a trailing

Modified: branches/aptitude-0.3/aptitude/src/download.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/download.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/download.cc	Mon Sep 26 21:41:41 2005
@@ -86,7 +86,8 @@
 {
   pkgSourceList src_list;
 
-  if(!(*apt_cache_file)->save_selection_list(*load_progress))
+  if(apt_cache_file != NULL &&
+     !(*apt_cache_file)->save_selection_list(*load_progress))
     return NULL;
 
   // FIXME: should save_selection_list do this?
@@ -148,7 +149,8 @@
   if(aptcfg->FindB(PACKAGE "::Forget-New-On-Update", false))
     do_forget_new();
 
-  if(aptcfg->FindB(PACKAGE "::AutoClean-After-Update", false))
+  if(apt_cache_file != NULL &&
+     aptcfg->FindB(PACKAGE "::AutoClean-After-Update", false))
     {
       vs_widget_ref msg = NULL;
       if(!text_download)
@@ -296,6 +298,12 @@
 			 pkgAcquire * &acq,
 			 pkgPackageManager * &pm_out)
 {
+  if(apt_cache_file == NULL)
+    {
+      _error->Error(_("The package cache is not available; unable to download and install packages."));
+      return false;
+    }
+
   if(!(*apt_cache_file)->save_selection_list(*load_progress))
     return false;
 



More information about the Aptitude-svn-commit mailing list