On Mon, Oct 10, 2005 at 08:27:18PM +0200, "Artur R. Czechowski" <[EMAIL 
PROTECTED]> was heard to say:
> Hello,
> I cannot reproduce this bug on demand but is still exists and happens.
> Backtrace is the same. This time I have a coredump. 52MB unpacked, 1.5M.
> I can make it available to you if you wish.

  Before we go to that trouble...I took a moment to look at your
backtrace, and I found one suspicious-looking thing in it: it looks like
the acquire code is accessing a pkgSourceList, but those are all
allocated on the stack and die before the download starts.  i.e., it's
accessing freed memory!

  Could you try the attached patch (which moves the list of sources to
the download object, so it doesn't get destroyed too early) and let me
know if the bug shows up again?

  Daniel
diff -rN -udp old-head/src/generic/apt/download_install_manager.cc 
new-head/src/generic/apt/download_install_manager.cc
--- old-head/src/generic/apt/download_install_manager.cc        2005-10-07 
18:49:36.000000000 -0700
+++ new-head/src/generic/apt/download_install_manager.cc        2005-10-10 
11:41:43.000000000 -0700
@@ -71,8 +71,6 @@ bool download_install_manager::prepare(O
        }
     }
 
-  // Get source lists.
-  pkgSourceList src_list;
   if(!src_list.ReadMainList())
     {
       _error->Error(_("Couldn't read source list"));
@@ -158,15 +156,6 @@ download_manager::result download_instal
 
   fetcher->Shutdown();
 
-  // Get source lists.
-  pkgSourceList src_list;
-  if(!src_list.ReadMainList())
-    {
-      _error->Error(_("Couldn't read source list"));
-
-      return failure;
-    }
-
   if(!pm->GetArchives(fetcher, &src_list, apt_package_records))
     return failure;
 
diff -rN -udp old-head/src/generic/apt/download_install_manager.h 
new-head/src/generic/apt/download_install_manager.h
--- old-head/src/generic/apt/download_install_manager.h 2005-10-04 
23:55:22.000000000 -0700
+++ new-head/src/generic/apt/download_install_manager.h 2005-10-10 
11:41:28.000000000 -0700
@@ -26,6 +26,7 @@
 
 #include <apt-pkg/packagemanager.h> // For OrderResult
 #include <apt-pkg/pkgcache.h>       // For logging
+#include <apt-pkg/sourcelist.h>
 
 #include <sigc++/signal.h>
 
@@ -44,6 +45,9 @@ class download_install_manager : public 
   /** The package manager object used when installing packages */
   pkgPackageManager *pm;
 
+  /** The list of sources from which to download. */
+  pkgSourceList src_list;
+
   /** Actually perform the installation/removal of packages and tell
    *  the caller what happened.
    */
diff -rN -udp old-head/src/generic/apt/download_update_manager.cc 
new-head/src/generic/apt/download_update_manager.cc
--- old-head/src/generic/apt/download_update_manager.cc 2005-10-07 
18:36:42.000000000 -0700
+++ new-head/src/generic/apt/download_update_manager.cc 2005-10-10 
11:42:46.000000000 -0700
@@ -26,7 +26,6 @@
 #include <apt-pkg/cachefile.h>
 #include <apt-pkg/clean.h>
 #include <apt-pkg/error.h>
-#include <apt-pkg/sourcelist.h>
 
 class my_cleaner:public pkgArchiveCleaner
 {
@@ -55,8 +54,6 @@ bool download_update_manager::prepare(Op
 {
   log = signallog;
 
-  pkgSourceList src_list;
-
   if(apt_cache_file != NULL &&
      !(*apt_cache_file)->save_selection_list(progress))
     return false;
diff -rN -udp old-head/src/generic/apt/download_update_manager.h 
new-head/src/generic/apt/download_update_manager.h
--- old-head/src/generic/apt/download_update_manager.h  2005-10-04 
23:55:22.000000000 -0700
+++ new-head/src/generic/apt/download_update_manager.h  2005-10-10 
11:42:43.000000000 -0700
@@ -22,6 +22,8 @@
 
 #include "download_manager.h"
 
+#include <apt-pkg/sourcelist.h>
+
 #include <sigc++/signal.h>
 
 class download_signal_log;
@@ -32,6 +34,8 @@ class download_update_manager : public d
   /** A signal log object upon which Complete() should be called. */
   download_signal_log *log;
 
+  pkgSourceList src_list;
+
 public:
   /** Create a new manager.  Note that acqlog and signallog may or may
    *  not be the same object (for instance, acqlog may be a log object

Attachment: signature.asc
Description: Digital signature

Reply via email to