summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2019-02-18 03:53:36 +0100
committerGuillem Jover <guillem@debian.org>2019-02-23 17:57:18 +0100
commit813024b95f3087fe018f73867ea30ad2a83321e5 (patch)
tree243071639d04a05e20b8b61dc1c3a8dad863d2a2
parent12dc155b63be057af5a1c6330106e496aeae3ee4 (diff)
downloaddpkg-813024b95f3087fe018f73867ea30ad2a83321e5.tar.gz
libdpkg: Blank packages that are not-installed with unknown selection
Versions before 1.13.10 did not properly clear the Origin and Bugs fields, so there might still be entries with these fields that are not getting garbage collected properly. Make sure to blank these package entries so that they get forgotten on the next database dump. Closes: #922410
-rw-r--r--debian/changelog2
-rw-r--r--lib/dpkg/parse.c11
2 files changed, 13 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 7d69fbaed..e40d7f93f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -34,6 +34,8 @@ dpkg (1.19.5) UNRELEASED; urgency=medium
* libdpkg: Print a more accurate warning for Revision nicknames.
* libdpkg: Increase the pkg-hash bins size to 65521, to improve hash table
performance at the cost of a bit more memory usage.
+ * libdpkg: Blank packages that are not-installed with unknown selection.
+ Closes: #922410
* Perl modules:
- Dpkg::Vendor::Debian: Add support for merged-usr-via-symlinks tainted
tag. Suggested by Alexander E. Patrakov <patrakov@gmail.com>.
diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index 863e42644..f7979b8e5 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -292,6 +292,17 @@ pkg_parse_verify(struct parsedb_state *ps,
pkg->want == PKG_WANT_INSTALL &&
pkgbin->arch->type == DPKG_ARCH_EMPTY)
pkg_set_want(pkg, PKG_WANT_UNKNOWN);
+
+ /* XXX: Versions before dpkg 1.13.10 did not blank the Origin and Bugs
+ * fields, so there can be packages that should be garbage collected but
+ * are lingering around. Blank them to make sure we will forget all about
+ * them on the next database dump. */
+ if (!(ps->flags & pdb_recordavailable) &&
+ pkg->status == PKG_STAT_NOTINSTALLED &&
+ pkg->eflag == PKG_EFLAG_OK &&
+ pkg->want == PKG_WANT_UNKNOWN) {
+ pkgbin_blank(pkgbin);
+ }
}
struct pkgcount {