From: Michael Vogt Date: Wed, 8 Oct 2014 18:13:56 +0000 (+0200) Subject: Only rename StatError files in AbortTransaction() X-Git-Tag: 1.1.exp5~12 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/edd007cdfccd8db603d1f11acbf9f30272afb48c Only rename StatError files in AbortTransaction() This fixes a race that we see in travis when two copy operations finish at about the same time but the bad one first. This lead to a rename of the good one and triggers a error when apt tries to verify the good version but can no longer find it. --- diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 1ff3e32dc..604a2e07e 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1545,10 +1545,13 @@ void pkgAcqMetaBase::AbortTransaction() if ((*I)->Status == pkgAcquire::Item::StatIdle) (*I)->Status = pkgAcquire::Item::StatDone; - // kill files in partial - std::string const PartialFile = GetPartialFileName(flNotDir((*I)->DestFile)); - if(FileExists(PartialFile)) - Rename(PartialFile, PartialFile + ".FAILED"); + // kill failed files in partial + if ((*I)->Status == pkgAcquire::Item::StatError) + { + std::string const PartialFile = GetPartialFileName(flNotDir((*I)->DestFile)); + if(FileExists(PartialFile)) + Rename(PartialFile, PartialFile + ".FAILED"); + } } } /*}}}*/