summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-01-08 17:51:23 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2016-01-08 17:51:23 +0100
commitef3c549e00b2a0487ddee0aeb70e3a29f76c2fbb (patch)
tree641cb5d6cc00b1efa5f111a5839c328662ca3f77 /apt-pkg/acquire-item.cc
parent4e6219da0dd1e68fad7db972f7ddd76598645228 (diff)
remove uncompressed leftover partial file before pdiff bootstrap
The code already deals with compressed leftovers, but forgot the uncompressed files. The opertunity is picked to reorder this code and add debug messages about the actions taken as well as produce such a leftover file in the associated testcase.
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc29
1 files changed, 21 insertions, 8 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index b73c4985f..446551cc2 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -2103,22 +2103,35 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string const &IndexDiffFile) /*{{{*/
// clean the plate
{
+ std::string const Final = GetExistingFilename(CurrentPackagesFile);
+ if (unlikely(Final.empty())) // because we wouldn't be called in such a case
+ return false;
std::string const PartialFile = GetPartialFileNameFromURI(Target.URI);
- std::vector<std::string> exts = APT::Configuration::getCompressorExtensions();
- for (auto const &ext : exts)
+ if (FileExists(PartialFile) && RemoveFile("Bootstrap-linking", PartialFile) == false)
+ {
+ if (Debug)
+ std::clog << "Bootstrap-linking for patching " << CurrentPackagesFile
+ << " by removing stale " << PartialFile << " failed!" << std::endl;
+ return false;
+ }
+ for (auto const &ext : APT::Configuration::getCompressorExtensions())
{
std::string const Partial = PartialFile + ext;
- if (FileExists(Partial))
- RemoveFile("PDiffs-Bootstrap", Partial);
+ if (FileExists(Partial) && RemoveFile("Bootstrap-linking", Partial) == false)
+ {
+ if (Debug)
+ std::clog << "Bootstrap-linking for patching " << CurrentPackagesFile
+ << " by removing stale " << Partial << " failed!" << std::endl;
+ return false;
+ }
}
- std::string const Final = GetExistingFilename(CurrentPackagesFile);
- if (unlikely(Final.empty())) // because we wouldn't be called in such a case
- return false;
std::string const Ext = Final.substr(CurrentPackagesFile.length());
std::string const Partial = PartialFile + Ext;
if (symlink(Final.c_str(), Partial.c_str()) != 0)
{
- std::clog << "Bootstrap-linking for patching " << CurrentPackagesFile << " by linking " << Final << " to " << Partial << " failed!" << std::endl;
+ if (Debug)
+ std::clog << "Bootstrap-linking for patching " << CurrentPackagesFile
+ << " by linking " << Final << " to " << Partial << " failed!" << std::endl;
return false;
}
}