summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-06-30 14:05:03 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-06-30 14:05:03 +0200
commit41b4dee4acaadda869840f7a94c58fd5b7d42017 (patch)
tree10fd810843c78319dd5b590108cb3460cd630783
parent5ee89a3c491f7e3210e6bbdd585bea9cfe0f0ace (diff)
* 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)
-rw-r--r--apt-pkg/pkgcachegen.cc22
-rw-r--r--debian/changelog9
2 files changed, 28 insertions, 3 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 9820fde81..8f9737e26 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -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);
diff --git a/debian/changelog b/debian/changelog
index 87d25e78f..d74baf2cc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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 ]