[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#803471: apt: the edsp output does not contain the APT-Candidiate field even if an exact version was requested



On Fri, Oct 30, 2015 at 01:33:59PM +0100, Johannes Schauer wrote:
> Package: apt
> Version: 1.0.10.2
> Severity: normal
> 
> Hi,

Hi,

> 
> The EDSP spec says that the Install field containing the installation
> request does not contain version numbers. Instead, packages can contain
> the APT-Candidate field set to Yes to denote that this version should be
> selected for installation.
> 
> Nevertheless, when I do:
> 
> 	apt-get --simulate install --solver dump -o APT::Solver::Strict-Pinning=false ghc=7.10.2-2
> 
> or
> 
> 	apt-get --simulate install --solver dump -o APT::Solver::Strict-Pinning=false ghc/experimental
> 
> then the resulting /tmp/dump.edsp does not contain any such field and
> thus the solver is not told which version of ghc to install.
> 
> This is even though the second command tells me:
> 
> 	Selected version '7.10.2-2' (Debian:experimental [amd64]) for 'ghc'
> 
> Please make it so that specifying ghc=7.10.2-2 or ghc/experimental on
> the apt command line both mark the right package stanza in the EDSP
> output with APT-Candidate:Yes.
> 
> I found this bug through bug #795827 but did not manage to find a
> followup bug that described this problem. CC-ing Ralf as the submitter
> of that bug and as the maintainer of apt-cudf in Debian.

thanks for you bug report.

The attached patch should in theory fix the issue.

I pushed it to
  https://github.com/julian-klode/apt/commits/bugfix/deb-803471
and will see what the CI server says about it.

-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.

Be friendly, do not top-post, and follow RFC 1855 "Netiquette".
    - If you don't I might ignore you.
>From 81a62b72b95766df2df3b0876e74fda2ed45f8a4 Mon Sep 17 00:00:00 2001
From: Julian Andres Klode <jak@debian.org>
Date: Fri, 30 Oct 2015 13:59:21 +0100
Subject: [PATCH] edsp: Use the selected candidate, not the policy candidate

When printing if a version is a candidate, consider the
candidate set in the depcache, and not the candidate in
the policy.

Closes: #803471
---
 apt-pkg/edsp.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc
index 90f2047..8d7a5ae 100644
--- a/apt-pkg/edsp.cc
+++ b/apt-pkg/edsp.cc
@@ -84,7 +84,7 @@ static void WriteScenarioVersion(pkgDepCache &Cache, FILE* output, pkgCache::Pkg
 	   fprintf(output, " %s\n", R->c_str());
    }
    fprintf(output, "APT-Pin: %d\n", Pin);
-   if (Cache.GetCandidateVer(Pkg) == Ver)
+   if (Cache[Pkg].CandidateVerIter(Cache) == Ver)
       fprintf(output, "APT-Candidate: yes\n");
    if ((Cache[Pkg].Flags & pkgCache::Flag::Auto) == pkgCache::Flag::Auto)
       fprintf(output, "APT-Automatic: yes\n");
-- 
2.6.2


Reply to: