summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/acquire.cc6
-rwxr-xr-xtest/integration/test-apt-update-expected-size4
2 files changed, 10 insertions, 0 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 145cbd56d..f2b80a5be 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)
diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size
index 4981e72c3..faf3a8612 100755
--- a/test/integration/test-apt-update-expected-size
+++ b/test/integration/test-apt-update-expected-size
@@ -23,6 +23,7 @@ test_inreleasetoobig() {
rm -f update.output
# ensure the failed InRelease file got renamed
testsuccess ls rootdir/var/lib/apt/lists/partial/*InRelease.FAILED
+ testfailure test -e rootdir/var/lib/apt/lists/partial/Old.FAILED
}
test_packagestoobig() {
@@ -38,6 +39,8 @@ test_packagestoobig() {
NEW_SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)"
testfailuremsg "E: Failed to fetch ${1}/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE)
E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::Transaction=0
+ testsuccess ls rootdir/var/lib/apt/lists/partial/*Packages*.FAILED
+ testfailure test -e rootdir/var/lib/apt/lists/partial/Old.FAILED
}
methodtest() {
@@ -49,6 +52,7 @@ methodtest() {
rm -rf rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists.good
# normal update works fine
testsuccess aptget update
+ touch rootdir/var/lib/apt/lists/partial/Old.FAILED
mv rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists.good
# starting fresh works