summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/acquire-item.cc13
-rwxr-xr-xtest/integration/test-pdiff-usage13
2 files changed, 26 insertions, 0 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 62d960633..ad40f8974 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -2476,8 +2476,21 @@ void pkgAcqIndexMergeDiffs::Done(string const &Message, HashStringList const &Ha
Item::Done(Message, Hashes, Cnf);
+ if (std::any_of(allPatches->begin(), allPatches->end(),
+ [](pkgAcqIndexMergeDiffs const * const P) { return P->State == StateErrorDiff; }))
+ {
+ if(Debug)
+ std::clog << "Another patch failed already, no point in processing this one." << std::endl;
+ return;
+ }
+
std::string const UncompressedUnpatchedFile = GetPartialFileNameFromURI(Target.URI);
std::string const UnpatchedFile = GetExistingFilename(UncompressedUnpatchedFile);
+ if (UnpatchedFile.empty())
+ {
+ _error->Fatal("Unpatched file %s doesn't exist (anymore)!", UnpatchedFile.c_str());
+ return;
+ }
std::string const PatchFile = GetMergeDiffsPatchFileName(UnpatchedFile, patch.file);
std::string const PatchedFile = GetKeepCompressedFileName(UncompressedUnpatchedFile, Target);
diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage
index 253abb92c..98d75d894 100755
--- a/test/integration/test-pdiff-usage
+++ b/test/integration/test-pdiff-usage
@@ -164,6 +164,19 @@ SHA256-Download:
testsuccessequal "$(cat Packages-future)
" aptcache show apt newstuff futurestuff
+ # we reuse the archive state of the previous test here
+ msgmsg "Testcase: downloading a patch fails, but successful fallback: $*"
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
+ cp Packages-future aptarchive/Packages
+ rm "${PATCHFILE}.gz"
+ testsuccess apt update "$@"
+ cp rootdir/tmp/testsuccess.output patchdownload.output
+ testsuccess grep '^Falling back to normal index file acquire' patchdownload.output
+ testnopackage oldstuff
+ testsuccessequal "$(cat Packages-future)
+" aptcache show apt newstuff futurestuff
+
msgmsg "Testcase: patch applying fails, but successful fallback: $*"
rm -rf rootdir/var/lib/apt/lists
cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists