From 6f43fac607c94f423f1d01708ecf947a8a303d38 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 28 Jan 2014 17:20:19 +0100 Subject: add test for Suite with path --- test/integration/test-apt-sources-deb822 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index 87f1886ea..5f54b7531 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -99,3 +99,14 @@ testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/source/Source 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris + +# a Suite +msgtest 'Test deb822 sources.list file which has' 'a exact path and no sections' +cat > $SOURCES < Date: Wed, 29 Jan 2014 10:37:17 +0100 Subject: fix apt-get download truncation (closes: #736962) --- cmdline/apt-get.cc | 9 ++++++--- test/integration/test-apt-get-download | 7 +++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index da7d28a1e..6bff6e7de 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -678,14 +678,17 @@ bool DoDownload(CommandLine &CmdL) // copy files in local sources to the current directory for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); ++I) - if ((*I)->Local == true && (*I)->Status == pkgAcquire::Item::StatDone) + { + std::string const filename = cwd + flNotDir((*I)->DestFile); + if ((*I)->Local == true && + filename != (*I)->DestFile && + (*I)->Status == pkgAcquire::Item::StatDone) { - std::string const filename = cwd + flNotDir((*I)->DestFile); std::ifstream src((*I)->DestFile.c_str(), std::ios::binary); std::ofstream dst(filename.c_str(), std::ios::binary); dst << src.rdbuf(); } - + } return Failed == false; } /*}}}*/ diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download index fce0be018..c2a5c3d8e 100755 --- a/test/integration/test-apt-get-download +++ b/test/integration/test-apt-get-download @@ -24,6 +24,7 @@ testdownload() { rm $1 } +# normal case(es) testdownload apt_1.0_all.deb apt stable testdownload apt_2.0_all.deb apt @@ -32,3 +33,9 @@ testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) SHA512:$(sh # deb:677887 testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms + +# deb:736962 - apt-get download foo && +aptget download apt +aptget download apt +testsuccess test -s apt_2.0_all.deb +rm -f apt_1.0_all.deb -- cgit v1.2.3 From 960975a175c2a21df749727162d5677cdc97a36e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 30 Jan 2014 15:06:26 +0100 Subject: do not crash if VF.File()/VF.File().Archive() is NULL --- apt-private/private-output.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index a8bbad9e5..e9b8037da 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -68,8 +68,10 @@ std::string GetArchiveSuite(pkgCacheFile &CacheFile, pkgCache::VerIterator ver) pkgCache::VerFileIterator VF = ver.FileList(); for (; VF.end() == false ; ++VF) { - // XXX: how to figure out the relevant suite? if its in multiple ones? - suite = suite + "," + VF.File().Archive(); + if(VF.File() == NULL || VF.File().Archive() == NULL) + suite = suite + "," + _("unknown"); + else + suite = suite + "," + VF.File().Archive(); //suite = VF.File().Archive(); } suite = suite.erase(0, 1); -- cgit v1.2.3