Bug#753297: apt list --upgradable gives lot of false positives: possible solution
Package: apt
Version: 1.0.6
Followup-For: Bug #753297
Hi all,
for me the problem (listing packages as upgradable if they are not) occurs for all
packages, which have a newer version in an archive with lower APT:Pinning score.
So if I understood the source correctly, the pkgPolicy handles the candidate version
in respect to the correct pinning.
The attached patch [1] should do the trick.
Regards Michael
[1] apt_753297.patch
--- apt-1.0.6/apt-private/private-cacheset.cc 2014-04-25 13:39:00.000000000 +0200
+++ apt-1.0.7/apt-private/private-cacheset.cc 2014-07-21 17:07:18.836716832 +0200
@@ -55,9 +55,10 @@
}
else if (_config->FindB("APT::Cmd::Upgradable") == true)
{
- if(P.CurrentVer() && state.Upgradable())
+ pkgPolicy *policy = CacheFile.GetPolicy();
+ pkgCache::VerIterator candidateVer = policy->GetCandidateVer(P);
+ if(P.CurrentVer() && state.Upgradable() && candidateVer.CompareVer(P.CurrentVer()) != 0)
{
- pkgPolicy *policy = CacheFile.GetPolicy();
output_set.insert(policy->GetCandidateVer(P));
}
}
-- Package-specific info:
-- (no /etc/apt/preferences present) --
-- (/etc/apt/sources.list present, but not submitted) --
-- System Information:
Debian Release: jessie/sid
APT prefers mike
APT policy: (500, 'mike'), (500, 'testing'), (103, 'unstable'), (102, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.14-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages apt depends on:
ii debian-archive-keyring 2012.4
ii gnupg 1.4.18-2
ii libapt-pkg4.12 1.0.6
ii libc6 2.19-7
ii libgcc1 1:4.9.0-7
ii libstdc++6 4.9.0-7
apt recommends no packages.
Versions of packages apt suggests:
pn apt-doc <none>
ii aptitude 0.6.11-1
ii dpkg-dev 1.17.10
ii python-apt 0.9.3.8
-- no debconf information
--- apt-1.0.6/apt-private/private-cacheset.cc 2014-04-25 13:39:00.000000000 +0200
+++ apt-1.0.6-753297/apt-private/private-cacheset.cc 2014-07-21 17:07:18.836716832 +0200
@@ -55,9 +55,10 @@
}
else if (_config->FindB("APT::Cmd::Upgradable") == true)
{
- if(P.CurrentVer() && state.Upgradable())
+ pkgPolicy *policy = CacheFile.GetPolicy();
+ pkgCache::VerIterator candidateVer = policy->GetCandidateVer(P);
+ if(P.CurrentVer() && state.Upgradable() && candidateVer.CompareVer(P.CurrentVer()) != 0)
{
- pkgPolicy *policy = CacheFile.GetPolicy();
output_set.insert(policy->GetCandidateVer(P));
}
}
Reply to: