summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-10-08 20:13:56 +0200
committerMichael Vogt <mvo@debian.org>2014-10-08 20:13:56 +0200
commitedd007cdfccd8db603d1f11acbf9f30272afb48c (patch)
treeb3dd5b79ec542aa4930d6634c414faea4a71f251 /apt-pkg
parent57766d984f92451dbfe0fc6f864060baacaa0f99 (diff)
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.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc11
1 files changed, 7 insertions, 4 deletions
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");
+ }
}
}
/*}}}*/