[Aptitude-devel] r3251 - in branches/aptitude-0.3/aptitude: . src
Daniel Burrows
dburrows@costa.debian.org
Mon, 02 May 2005 00:07:05 +0000
Author: dburrows
Date: Mon May 2 00:07:01 2005
New Revision: 3251
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/solution_fragment.cc
Log:
Fix a segfault triggered by attempting to display solutions to dependency problems.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Mon May 2 00:07:01 2005
@@ -1,5 +1,10 @@
2005-05-01 Daniel Burrows <dburrows@debian.org>
+ * src/solution_fragment.cc:
+
+ Fix a silly thinko that caused segfaults when trying to display
+ problem solutions.
+
* src/generic/problemresolver/Makefile.am:
Uh, yeah, also distribute the problem resolver's header file.
Modified: branches/aptitude-0.3/aptitude/src/solution_fragment.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/solution_fragment.cc (original)
+++ branches/aptitude-0.3/aptitude/src/solution_fragment.cc Mon May 2 00:07:01 2005
@@ -67,16 +67,15 @@
{
// Bin packages according to what will happen to them.
vector<pkgCache::PkgIterator> remove_packages;
- vector<pkgCache::VerIterator> keep_packages;
+ vector<pkgCache::PkgIterator> keep_packages;
vector<pkgCache::VerIterator> install_packages;
vector<pkgCache::VerIterator> downgrade_packages;
vector<pkgCache::VerIterator> upgrade_packages;
sort(remove_packages.begin(), remove_packages.end(),
pkg_name_lt());
-
sort(keep_packages.begin(), keep_packages.end(),
- ver_name_lt());
+ pkg_name_lt());
sort(install_packages.begin(), install_packages.end(),
ver_name_lt());
sort(downgrade_packages.begin(), downgrade_packages.end(),
@@ -93,11 +92,16 @@
pkgCache::VerIterator newver=i->second.ver.get_ver();
if(curver.end())
- install_packages.push_back(newver);
+ {
+ if(newver.end())
+ keep_packages.push_back(pkg);
+ else
+ install_packages.push_back(newver);
+ }
else if(newver.end())
remove_packages.push_back(pkg);
else if(newver == curver)
- keep_packages.push_back(curver);
+ keep_packages.push_back(pkg);
else
{
int cmp=_system->VS->CmpVersion(curver.VerStr(),
@@ -146,12 +150,19 @@
if(!keep_packages.empty())
{
fragments.push_back(fragf(_("%BKeep%b the following packages at their current version:%n")));
- for(vector<pkgCache::VerIterator>::const_iterator i=keep_packages.begin();
+ for(vector<pkgCache::PkgIterator>::const_iterator i=keep_packages.begin();
i!=keep_packages.end(); ++i)
- fragments.push_back(fragf(" %s [%s (%F)]%n",
- i->ParentPkg().Name(),
- i->VerStr(),
- archives_fragment(*i)));
+ {
+ if(i->CurrentVer().end())
+ fragments.push_back(fragf(" %s [%s]%n",
+ i->Name(),
+ _("Not Installed")));
+ else
+ fragments.push_back(fragf(" %s [%s (%F)]%n",
+ i->Name(),
+ i->CurrentVer().VerStr(),
+ archives_fragment(i->CurrentVer())));
+ }
fragments.push_back(newline_fragment());
}