summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-07-24 01:15:55 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2017-07-26 19:07:55 +0200
commit8df85a4fb91bed6c79a3cb9c2000881cc5b42ea7 (patch)
tree8359afbe47e137fa2b1f5b5c4ab281f79e71f518
parent245b9b077f907f2a1a587e5f66964ab6e4becac8 (diff)
don't move failed pdiff indexes out of partial
The comment says this is intended, but looking at the history reveals that the comment comes from a different era. Nowadays we don't really need it anymore (and even back then it was disputeable) as we haven't used that file for our update in the end and nothing really needs this file after the update. Triggered is this by 188f297a2af4c15cb1d502360d1e478644b5b810 which moves various error conditions forward including this code expecting the file to exist – but it doesn't need to as download could have failed. We could fix that by simple checking if the file exists and only stage it if it does, but instead we don't stage it and instead even rename it out of the way with our conventional FAILED name (if it exists). That restores support for partial mirrors (= in this case mirrors which don't ship pdiff files). Note that apt heals itself even if only such a mirror is used as the update is successful even if that error is shown. Closes: 869425
-rw-r--r--apt-pkg/acquire-item.cc5
-rwxr-xr-xtest/integration/test-pdiff-usage30
2 files changed, 31 insertions, 4 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 057adfa5b..4e47b9c30 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -2465,13 +2465,10 @@ void pkgAcqDiffIndex::Failed(string const &Message,pkgAcquire::MethodConfig cons
if (CommonFailed(GetDiffIndexURI(Target), GetDiffIndexFileName(Target.Description), Message, Cnf))
return;
+ RenameOnError(PDiffError);
Status = StatDone;
ExpectedAdditionalItems = 0;
- // queue for final move - this should happen even if we fail
- // while parsing (e.g. on sizelimit) and download the complete file.
- TransactionManager->TransactionStageCopy(this, DestFile, GetFinalFilename());
-
if(Debug)
std::clog << "pkgAcqDiffIndex failed: " << Desc.URI << " with " << Message << std::endl
<< "Falling back to normal index file acquire" << std::endl;
diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage
index e7b052d49..6a6f13b1b 100755
--- a/test/integration/test-pdiff-usage
+++ b/test/integration/test-pdiff-usage
@@ -340,6 +340,36 @@ SHA256-Download:
testnopackage oldstuff
testsuccessequal "$(cat "${PKGFILE}-new")
" aptcache show apt newstuff
+
+ msgmsg "Testcase: pdiff index failed to download: $*"
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
+ cp "${PKGFILE}-new" aptarchive/Packages
+ compressfile 'aptarchive/Packages'
+ mkdir -p aptarchive/Packages.diff
+ PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
+ diff -e "${PKGFILE}" "${PKGFILE}-new" > "${PATCHFILE}" || true
+ cat "$PATCHFILE" | gzip > "${PATCHFILE}.gz"
+ PATCHINDEX='aptarchive/Packages.diff/Index'
+ echo "SHA256-Current: $(sha256sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new")
+SHA256-History:
+ 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28
+ $(sha256sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
+SHA256-Patches:
+ e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
+ $(sha256sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE")
+SHA256-Download:
+ d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz
+ $(sha256sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") $(basename "${PATCHFILE}.gz")" > "$PATCHINDEX"
+ generatereleasefiles '+1hour'
+ signreleasefiles
+ # we let it fail by removing the files so the webserver reports 404
+ rm -f "$PATCHINDEX" "$PATCHFILE" "${PATCHFILE}.gz"
+ wasmergeused "$@" -o test::cannot-use-pdiff=1
+ testsuccess grep '400%20URI%20Failure.*Packages\.diff/Index.*FailReason.*HttpError404' rootdir/tmp/aptupdate.output
+ testnopackage oldstuff
+ testsuccessequal "$(cat "${PKGFILE}-new")
+" aptcache show apt newstuff
}
echo 'Debug::pkgAcquire::Diffs "true";
Debug::Acquire::Transaction "true";