Kaynağa Gözat

dpkg: Properly mark packages being purged for disappearance

When a package has been purged, it should be marked as want_unknown
and the configversion blanked, otherwise dpkg considers it to still
be informative and keeps it around, which needs later on manual
intervention from the user to clean up the database.
Guillem Jover 17 yıl önce
ebeveyn
işleme
6c6ec4a438
3 değiştirilmiş dosya ile 7 ekleme ve 1 silme
  1. 3 0
      debian/changelog
  2. 2 1
      src/processarc.c
  3. 2 0
      src/remove.c

+ 3 - 0
debian/changelog

@@ -10,6 +10,9 @@ dpkg (1.15.4) UNRELEASED; urgency=low
     .dsc parsing code. As a side effect it now handles properly bogus files.
   * Do not remap obsolete fields in dpkg-scanpackages as they have been
     handled already by “dpkg-deb -I”.
+  * Properly mark packages being purged for disappearance from the database.
+    This will make the status database not be left behind with traces of old
+    not-installed packages.
 
   [ Raphael Hertzog ]
   * Replace install-info by a wrapper around GNU's install-info. The wrapper

+ 2 - 1
src/processarc.c

@@ -1065,9 +1065,10 @@ void process_archive(const char *filename) {
     pop_cleanup(ehflag_normaltidy); /* closedir */
     
     otherpkg->status= stat_notinstalled;
-    otherpkg->want= want_purge;
+    otherpkg->want = want_unknown;
     otherpkg->eflag= eflagv_ok;
 
+    blankversion(&otherpkg->configversion);
     blankpackageperfile(&otherpkg->installed);
 
     otherpkg->clientdata->fileslistvalid= 0;

+ 2 - 0
src/remove.c

@@ -549,6 +549,7 @@ void removal_bulk(struct pkginfo *pkg) {
     debug(dbg_general, "removal_bulk no postrm, no conffiles, purging");
     pkg->want= want_purge;
 
+    blankversion(&pkg->configversion);
   } else if (pkg->want == want_purge) {
 
     removal_bulk_remove_configfiles(pkg);
@@ -580,6 +581,7 @@ void removal_bulk(struct pkginfo *pkg) {
     if (unlink(fnvb.buf) && errno != ENOENT) ohshite(_("can't remove old postrm script"));
 
     pkg->status= stat_notinstalled;
+    pkg->want = want_unknown;
 
     /* This will mess up reverse links, but if we follow them
      * we won't go back because pkg->status is stat_notinstalled.