Selaa lähdekoodia

dpkg: Always reset want status when removing or purging a package

Move pkg_set_want() and modstatdb_note() calls from deferred_remove()
to the beginning of the function so that it affects all remove/purge
requests, even if it ends up getting ignored so that we can properly
update the wanted status.

Do not try to set the want status for packages with want_unknown.

Closes: #163763
Guillem Jover 13 vuotta sitten
vanhempi
commit
f8d3fee967
2 muutettua tiedostoa jossa 12 lisäystä ja 10 poistoa
  1. 2 0
      debian/changelog
  2. 10 10
      src/remove.c

+ 2 - 0
debian/changelog

@@ -60,6 +60,8 @@ dpkg (1.17.0) UNRELEASED; urgency=low
     current one and the specific maintainer script filename, and if it's
     current one and the specific maintainer script filename, and if it's
     not different to the current one, use "dpkg_script_t" as a fallback.
     not different to the current one, use "dpkg_script_t" as a fallback.
   * Do not unnecessarily create a dpkg update log record on remove or purge.
   * Do not unnecessarily create a dpkg update log record on remove or purge.
+  * Always reset want status when removing or purging a package; so this
+    now resets holds among others. Closes: #163763
 
 
  -- Guillem Jover <guillem@debian.org>  Fri, 03 Aug 2012 13:21:00 +0200
  -- Guillem Jover <guillem@debian.org>  Fri, 03 Aug 2012 13:21:00 +0200
 
 

+ 10 - 10
src/remove.c

@@ -90,6 +90,16 @@ void deferred_remove(struct pkginfo *pkg) {
   debug(dbg_general, "deferred_remove package %s",
   debug(dbg_general, "deferred_remove package %s",
         pkg_name(pkg, pnaw_always));
         pkg_name(pkg, pnaw_always));
 
 
+  if (!f_pending && pkg->want != want_unknown) {
+    if (cipaction->arg_int == act_purge)
+      pkg_set_want(pkg, want_purge);
+    else
+      pkg_set_want(pkg, want_deinstall);
+
+    if (!f_noact)
+      modstatdb_note(pkg);
+  }
+
   if (pkg->status == stat_notinstalled) {
   if (pkg->status == stat_notinstalled) {
     warning(_("ignoring request to remove %.250s which isn't installed"),
     warning(_("ignoring request to remove %.250s which isn't installed"),
             pkg_name(pkg, pnaw_nonambig));
             pkg_name(pkg, pnaw_nonambig));
@@ -109,16 +119,6 @@ void deferred_remove(struct pkginfo *pkg) {
     forcibleerr(fc_removeessential, _("This is an essential package -"
     forcibleerr(fc_removeessential, _("This is an essential package -"
                 " it should not be removed."));
                 " it should not be removed."));
 
 
-  if (!f_pending) {
-    if (cipaction->arg_int == act_purge)
-      pkg_set_want(pkg, want_purge);
-    else
-      pkg_set_want(pkg, want_deinstall);
-
-    if (!f_noact)
-      modstatdb_note(pkg);
-  }
-
   debug(dbg_general, "checking dependencies for remove '%s'",
   debug(dbg_general, "checking dependencies for remove '%s'",
         pkg_name(pkg, pnaw_always));
         pkg_name(pkg, pnaw_always));
   rok= 2;
   rok= 2;