From c5fced388848b967f0ce076656cad5366517f981 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 31 Jul 2014 18:40:05 +0200 Subject: ensure InRelease->Release is transactional as well --- apt-pkg/acquire-item.cc | 5 +++-- test/integration/test-apt-update-rollback | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 31dc2073d..2d9328b6b 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1888,6 +1888,7 @@ void pkgAcqMetaIndex::Failed(string /*Message*/, ReportMirrorFailure("GPGFailure"); } #endif + /* Always move the meta index, even if gpgv failed. This ensures * that PackageFile objects are correctly filled in */ if (FileExists(DestFile)) { @@ -1902,9 +1903,9 @@ void pkgAcqMetaIndex::Failed(string /*Message*/, "Release"); SigFile = FinalFile; } - Rename(DestFile,FinalFile); - chmod(FinalFile.c_str(),0644); + // Done, queue for rename on transaction finished + PartialFile = DestFile; DestFile = FinalFile; } diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index 9771f0edc..c16e4f480 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -150,6 +150,22 @@ E: Some index files failed to download. They have been ignored, or old ones used E: There are problems and -y was used without --force-yes" aptget install -qq -y old } +test_inrelease_to_unauth_inrelease() { + msgmsg "Test InRelease to InRelease without sig" + create_fresh_archive + signreleasefiles 'Marvin Paranoid' + avoid_ims_hit + + testsuccess aptget update -qq + + testequal "WARNING: The following packages cannot be authenticated! + old +E: There are problems and -y was used without --force-yes" aptget install -qq -y old + + testfailure ls rootdir/var/lib/apt/lists/*_InRelease + testsuccess ls rootdir/var/lib/apt/lists/*_Release +} + TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework @@ -179,3 +195,5 @@ test_inreleae_to_valid_release test_inreleae_to_release_reverts_all test_unauthenticated_to_invalid_inrelease + +test_inrelease_to_unauth_inrelease -- cgit v1.2.3