Bug#738103: apt-get download: can't specify the same package twice
On Fri, Feb 07, 2014 at 07:52:35PM +0100, Jakub Wilk wrote:
> Package: apt
> Version: 0.9.15.1
> Severity: minor
Thanks for your bugreport.
> "apt-get download" normally silently ignores packages that are
> already downloaded. However, it doesn't behave that way if you
> specify the same package twice on the command line:
>
> $ apt-get download dash dash
> Get:1 http://ftp.debian.org/debian/ unstable/main dash i386 0.5.7-4 [105 kB]
> Fetched 105 kB in 0s (9070 kB/s)
> E: Failed to fetch http://ftp.debian.org/debian/pool/main/d/dash/dash_0.5.7-4_i386.deb
I can reproduce the issue here and the attached patch should fix the
problem (and adds a regression test). Thanks again for reporting!
Cheers,
Michael
>From 8f3594c3487800edc2a97af1f3290049776dc556 Mon Sep 17 00:00:00 2001
From: Michael Vogt <mvo@debian.org>
Date: Wed, 12 Feb 2014 07:59:07 +0100
Subject: [PATCH] Use a APT::VersionSet instead of a VersionList
Use a APT::VersionSet instead of a APT::VersionList in DoDownload()
to ensure that there is only one version in the set even if the
user passes multiple identical name/versions on the commandline
(Bug#738103)
---
cmdline/apt-get.cc | 6 +++---
test/integration/test-apt-get-download | 5 +++++
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 1019ff3..4d60910 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -630,8 +630,8 @@ bool DoDownload(CommandLine &CmdL)
return false;
APT::CacheSetHelper helper(c0out);
- APT::VersionList verset = APT::VersionList::FromCommandLine(Cache,
- CmdL.FileList + 1, APT::VersionList::CANDIDATE, helper);
+ APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache,
+ CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper);
if (verset.empty() == true)
return false;
@@ -650,7 +650,7 @@ bool DoDownload(CommandLine &CmdL)
std::string const cwd = SafeGetCWD();
_config->Set("Dir::Cache::Archives", cwd);
int i = 0;
- for (APT::VersionList::const_iterator Ver = verset.begin();
+ for (APT::VersionSet::const_iterator Ver = verset.begin();
Ver != verset.end(); ++Ver, ++i)
{
pkgAcquire::Item *I = new pkgAcqArchive(&Fetcher, SrcList, &Recs, *Ver, storefile[i]);
diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download
index c2a5c3d..0d92283 100755
--- a/test/integration/test-apt-get-download
+++ b/test/integration/test-apt-get-download
@@ -39,3 +39,8 @@ aptget download apt
aptget download apt
testsuccess test -s apt_2.0_all.deb
rm -f apt_1.0_all.deb
+
+# deb:738103 - apt-get download foo foo fails
+rm -f apt_*.deb
+aptget download apt apt
+testsuccess test -s apt_2.0_all.deb
--
1.8.3.2
Reply to: