Преглед изворни кода

edsp: prevent it from trying to write a cache

EDSP(-like) protocols are one-shot processes working on data which
exists only as long as they run (as they get feed via a pipe), so trying
to write a cache for it is pretty pointless, especially as it will
usually fail as the cache files tend to be owned by root, but the
process is run as a unpriviledged user (either _apt if called by root,
otherwise the user of the caller).

So this was in fact only observeable with our testcases which run as
non-root and the worst which happens is that a valid cache is overridden
with an invalid one which the next run will detect and not use.

Git-Dch: Ignore
David Kalnischkies пре 10 година
родитељ
комит
35f3ed061f
1 измењених фајлова са 6 додато и 0 уклоњено
  1. 6 0
      apt-pkg/edsp/edspsystem.cc

+ 6 - 0
apt-pkg/edsp/edspsystem.cc

@@ -60,11 +60,17 @@ pkgPackageManager *edspLikeSystem::CreatePM(pkgDepCache * /*Cache*/) const
 // System::Initialize - Setup the configuration space..			/*{{{*/
 // System::Initialize - Setup the configuration space..			/*{{{*/
 bool edspLikeSystem::Initialize(Configuration &Cnf)
 bool edspLikeSystem::Initialize(Configuration &Cnf)
 {
 {
+   // state is included completely in the input files
    Cnf.Set("Dir::Etc::preferencesparts", "/dev/null");
    Cnf.Set("Dir::Etc::preferencesparts", "/dev/null");
    Cnf.Set("Dir::State::status","/dev/null");
    Cnf.Set("Dir::State::status","/dev/null");
    Cnf.Set("Dir::State::lists","/dev/null");
    Cnf.Set("Dir::State::lists","/dev/null");
+   // do not store an mmap cache
+   Cnf.Set("Dir::Cache::pkgcache", "");
+   Cnf.Set("Dir::Cache::srcpkgcache", "");
+   // the protocols only propose actions, not do them
    Cnf.Set("Debug::NoLocking", "true");
    Cnf.Set("Debug::NoLocking", "true");
    Cnf.Set("APT::Get::Simulate", "true");
    Cnf.Set("APT::Get::Simulate", "true");
+
    StatusFile.reset(nullptr);
    StatusFile.reset(nullptr);
    return true;
    return true;
 }
 }