]> git.saurik.com Git - apt.git/commitdiff
* apt-pkg/pkgcachegen.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 30 Jun 2011 12:05:03 +0000 (14:05 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 30 Jun 2011 12:05:03 +0000 (14:05 +0200)
  - fallback to memory if file is not writeable even if access()
    told us the opposite before (e.g. in fakeroot 1.16) (Closes: #630591)

apt-pkg/pkgcachegen.cc
debian/changelog

index 9820fde81996c413494970f74f4eb57834b8cba9..8f9737e265e9de696b225cd7f6867e47e177d775 100644 (file)
@@ -1169,16 +1169,32 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
    SPtr<DynamicMMap> Map;
    if (Writeable == true && CacheFile.empty() == false)
    {
+      _error->PushToStack();
       unlink(CacheFile.c_str());
       CacheF = new FileFd(CacheFile,FileFd::WriteAtomic);
       fchmod(CacheF->Fd(),0644);
       Map = CreateDynamicMMap(CacheF, MMap::Public);
       if (_error->PendingError() == true)
-        return false;
-      if (Debug == true)
+      {
+        delete CacheF.UnGuard();
+        delete Map.UnGuard();
+        if (Debug == true)
+           std::clog << "Open filebased MMap FAILED" << std::endl;
+        Writeable = false;
+        if (AllowMem == false)
+        {
+           _error->MergeWithStack();
+           return false;
+        }
+        _error->RevertToStack();
+      }
+      else if (Debug == true)
+      {
+        _error->MergeWithStack();
         std::clog << "Open filebased MMap" << std::endl;
+      }
    }
-   else
+   if (Writeable == false || CacheFile.empty() == true)
    {
       // Just build it in memory..
       Map = CreateDynamicMMap(NULL);
index 87d25e78ffdac0406c547b23928284ca2798bb53..d74baf2cce922064652ce9e91af662e3196ed575 100644 (file)
@@ -1,3 +1,12 @@
+apt (0.8.15.2) unstable; urgency=low
+
+  [ David Kalnischkies ]
+  * apt-pkg/pkgcachegen.cc:
+    - fallback to memory if file is not writeable even if access()
+      told us the opposite before (e.g. in fakeroot 1.16) (Closes: #630591)
+
+ -- David Kalnischkies <kalnischkies@gmail.com>  Thu, 30 Jun 2011 14:00:54 +0200
+
 apt (0.8.15.1) unstable; urgency=low
 
   [ David Kalnischkies ]