diff options
Diffstat (limited to 'apt-pkg/acquire.cc')
-rw-r--r-- | apt-pkg/acquire.cc | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 5d85beec6..8df7a3239 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -117,6 +117,12 @@ static bool SetupAPTPartialDirectory(std::string const &grand, std::string const if (chmod(partial.c_str(), 0700) != 0) _error->WarningE("SetupAPTPartialDirectory", "chmod 0700 of directory %s failed", partial.c_str()); + _error->PushToStack(); + // remove 'old' FAILED files to stop us from collecting them for no reason + for (auto const &Failed: GetListOfFilesInDir(partial, "FAILED", false, false)) + RemoveFile("SetupAPTPartialDirectory", Failed); + _error->RevertToStack(); + return true; } bool pkgAcquire::Setup(pkgAcquireStatus *Progress, string const &Lock) @@ -639,7 +645,7 @@ static void CheckDropPrivsMustBeDisabled(pkgAcquire const &Fetcher) // if destination file is inaccessible all hope is lost for privilege dropping if (IsAccessibleBySandboxUser((*I)->DestFile, true) == false) { - _error->WarningE("pkgAcquire::Run", _("Can't drop privileges for downloading as file '%s' couldn't be accessed by user '%s'."), + _error->WarningE("pkgAcquire::Run", _("Download is performed unsandboxed as root as file '%s' couldn't be accessed by user '%s'."), (*I)->DestFile.c_str(), SandboxUser.c_str()); _config->Set("APT::Sandbox::User", ""); break; @@ -656,7 +662,7 @@ static void CheckDropPrivsMustBeDisabled(pkgAcquire const &Fetcher) if (IsAccessibleBySandboxUser(source.Path, false) == false) { - _error->NoticeE("pkgAcquire::Run", _("Can't drop privileges for downloading as file '%s' couldn't be accessed by user '%s'."), + _error->NoticeE("pkgAcquire::Run", _("Download is performed unsandboxed as root as file '%s' couldn't be accessed by user '%s'."), source.Path.c_str(), SandboxUser.c_str()); _config->CndSet("Binary::file::APT::Sandbox::User", "root"); _config->CndSet("Binary::copy::APT::Sandbox::User", "root"); @@ -911,11 +917,27 @@ pkgAcquire::Queue::~Queue() /* */ bool pkgAcquire::Queue::Enqueue(ItemDesc &Item) { + // MetaKeysMatch checks whether the two items have no non-matching + // meta-keys. If the items are not transaction items, it returns + // true, so other items can still be merged. + auto MetaKeysMatch = [](pkgAcquire::ItemDesc const &A, pkgAcquire::Queue::QItem const *B) { + auto OwnerA = dynamic_cast<pkgAcqTransactionItem*>(A.Owner); + if (OwnerA == nullptr) + return true; + + for (auto const & OwnerBUncast : B->Owners) { + auto OwnerB = dynamic_cast<pkgAcqTransactionItem*>(OwnerBUncast); + + if (OwnerB != nullptr && OwnerA->GetMetaKey() != OwnerB->GetMetaKey()) + return false; + } + return true; + }; QItem **OptimalI = &Items; QItem **I = &Items; // move to the end of the queue and check for duplicates here for (; *I != 0; ) { - if (Item.URI == (*I)->URI) + if (Item.URI == (*I)->URI && MetaKeysMatch(Item, *I)) { if (_config->FindB("Debug::pkgAcquire::Worker",false) == true) std::cerr << " @ Queue: Action combined for " << Item.URI << " and " << (*I)->URI << std::endl; |