From fdf9eef4d96a18d0167708499c993e1174251e88 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 20 May 2016 09:37:24 +0200 Subject: fail instead of segfault on unreadable config files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The report mentions "apt list --upgradable", but there are others which have inconsistent behavior ranging from segfaulting to doing something with the partial (and hence incomplete) data. We had a recent report about sources.list (#818628), this one mentions prefences, the obvious next step is conf files… so the testcase is adapted to check for all three in file and directory versions and run a bunch of commands each time which should all have more or less the same behavior in such a case (aka error out). Closes: 824503 --- apt-pkg/cachefile.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'apt-pkg/cachefile.cc') diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc index 0e2192973..b5f32fc29 100644 --- a/apt-pkg/cachefile.cc +++ b/apt-pkg/cachefile.cc @@ -173,6 +173,9 @@ bool pkgCacheFile::BuildPolicy(OpProgress * /*Progress*/) /* */ bool pkgCacheFile::BuildDepCache(OpProgress *Progress) { + if (BuildCaches(Progress, false) == false) + return false; + std::unique_ptr DCache; if (this->DCache != NULL) return true; -- cgit v1.2.3