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

Bug#670401: Bug#673065: rred segfaults during apt-get update



reassign 673065 libapt-pkg4.12
reassign 670401 libapt-pkg4.12
forcemerge 673065 670401
tag 673065 + patch
thanks


So, after hitting it myself again while trying to work on something else
(as always) here we go with my second try on fixing this
(and this time i am reasonable sure that it is for real):

=== modified file 'apt-pkg/contrib/mmap.cc'
--- apt-pkg/contrib/mmap.cc     2012-01-17 23:40:38 +0000
+++ apt-pkg/contrib/mmap.cc     2012-05-21 17:12:25 +0000
@@ -84,6 +84,7 @@
       if ((Flags & ReadOnly) != ReadOnly)
         return _error->Error("Compressed file %s can only be mapped
readonly", Fd.Name().c_str());
       Base = new unsigned char[iSize];
+      SyncToFd = new FileFd();
       if (Fd.Seek(0L) == false || Fd.Read(Base, iSize) == false)
         return _error->Error("Compressed file %s can't be read into
mmap", Fd.Name().c_str());
       return true;

=== modified file 'debian/changelog'
--- debian/changelog    2012-05-21 14:50:52 +0000
+++ debian/changelog    2012-05-21 17:12:25 +0000
@@ -7,6 +7,10 @@
   * buildlib/inttypes.h.in:
     - remove inttypes.h compatibility as providing such a c99 types
       compatibility conflicts with the usage of c99 type long long
+  * apt-pkg/contrib/mmap.cc:
+    - have a dummy SyncToFd around in case of ReadOnly access to a
+      compressed file as we otherwise on Close() do not delete[] the
+      char buffer but munmap() it… (Closes: #673815)

  -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 21 May 2012
15:10:49 +0200


In case you wonder, yes it is always the same, the most painful to debug
problems which eat hours end up being fixed with a single line…
(the changelog says it all basically, so i will spare further details.)
Feel free to test the patch, otherwise its on the list for an upload
tomor^Wtoday.


Best regards

David Kalnischkies



Reply to: