Browse Source

ignore AllowMem parameter in cache generation

The parameter name suggests that it should forbid the building of the
entire cache in memory, but this isn't how it was previously and as
AllowMem is false by default it actually prevents previous usecases from
working like being root and configuring apt to build no caches at all.

This should be fixed at some point to actually work, but that is hard to
pull off as it means switching the default and some callers (including
apt itself) actually did call it explicitly with false in certain
cases for no apparent reason (at least now where it is common to have
enough memory to throw at every problem and even if not is a slow apt
usally better than an apt erroring out).

Closes: 796459
debian/1.8.y
David Kalnischkies 7 years ago
parent
commit
c417197501
  1. 7
      apt-pkg/cachefile.cc
  2. 13
      apt-pkg/pkgcachegen.cc

7
apt-pkg/cachefile.cc

@ -84,17 +84,14 @@ bool pkgCacheFile::BuildCaches(OpProgress *Progress, bool WithLock)
if (WithLock == true)
if (_system->Lock() == false)
return false;
if (_config->FindB("Debug::NoLocking",false) == true)
WithLock = false;
if (_error->PendingError() == true)
return false;
BuildSourceList(Progress);
// Read the caches
bool Res = pkgCacheGenerator::MakeStatusCache(*SrcList,Progress,&Map,!WithLock);
bool Res = pkgCacheGenerator::MakeStatusCache(*SrcList,Progress,&Map, true);
if (Progress != NULL)
Progress->Done();
if (Res == false)

13
apt-pkg/pkgcachegen.cc

@ -1516,8 +1516,9 @@ APT_DEPRECATED bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
MMap **OutMap, bool AllowMem)
{ return pkgCacheGenerator::MakeStatusCache(List, &Progress, OutMap, AllowMem); }
bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress,
MMap **OutMap,bool AllowMem)
MMap **OutMap,bool)
{
// FIXME: deprecate the ignored AllowMem parameter
bool const Debug = _config->FindB("Debug::pkgCacheGen", false);
std::vector<pkgIndexFile *> Files;
@ -1582,16 +1583,6 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
if (Debug == true)
std::clog << "Do we have write-access to the cache files? " << (Writeable ? "YES" : "NO") << std::endl;
if (Writeable == false && AllowMem == false)
{
if (CacheFile.empty() == false)
return _error->Error(_("Unable to write to %s"),flNotFile(CacheFile).c_str());
else if (SrcCacheFile.empty() == false)
return _error->Error(_("Unable to write to %s"),flNotFile(SrcCacheFile).c_str());
else
return _error->Error("Unable to create caches as file usage is disabled, but memory not allowed either!");
}
}
// At this point we know we need to construct something, so get storage ready

Loading…
Cancel
Save