]> err.no Git - dpkg/commitdiff
Fix failed install followed by failed remove resulting in installed state
authorBrian M. Carlson <sandals@crustytoothpaste.ath.cx>
Fri, 14 Sep 2007 05:24:56 +0000 (08:24 +0300)
committerGuillem Jover <guillem@debian.org>
Sat, 15 Sep 2007 03:37:47 +0000 (06:37 +0300)
After '<prerm> remove' fails and while doing the error unwinding, if
the '<postinst> abort-remove' call succeeds, preserve the old status
instead of unconditionally setting it to 'Installed'.

ChangeLog
debian/changelog
src/cleanup.c
src/remove.c

index 598af20201339954728845e40bb678a597c2b168..b76379c68a0dd25aae03cf2422944b3659dccb21 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-09-14  Brian M. Carlson  <sandals@crustytoothpaste.ath.cx>
+
+       * src/remove.c (deferred_remove): Store the previous package status
+       when calling '<prerm> remove' and pass it to push_cleanup.
+       * src/cleanup.c (cu_prermremove): Restore previous stored status if
+       the '<postinst> abort-remove' call succeeds.
+
 2007-09-08  Guillem Jover  <guillem@debian.org>
 
        * scripts/dpkg-buildpackage.sh: Use fakeroot, if present, as default
index c461eebc65f9915d8ac9b1f1cd6f2c46faf02b5b..2893b1b0c1d119667c5cfa7bd1115eb3d9b82871 100644 (file)
@@ -10,6 +10,10 @@ dpkg (1.14.7) UNRELEASED; urgency=low
     dpkg-buildpackage.
   * Fix typos in dpkg-deb.1 and start-stop-daemon.8. Closes: #441051
     Thanks to A. Costa.
+  * After '<prerm> remove' fails and while doing the error unwinding, if
+    the '<postinst> abort-remove' call succeeds, preserve the old status
+    instead of unconditionally setting it to 'Installed'. Closes: #432893
+    Thanks to Brian M. Carlson.
 
   [ Updated dpkg translations ]
   * Portuguese (Miguel Figueiredo). Closes: #441113
index 108ee2c1daf50cfdbbc1457306dccb36d4a98181..d1ebb68aacae4a7262d3bfba52b5ea233d447b99 100644 (file)
@@ -233,11 +233,12 @@ void cu_postrmupgrade(int argc, void **argv) {
 
 void cu_prermremove(int argc, void **argv) {
   struct pkginfo *pkg= (struct pkginfo*)argv[0];
+  enum pkgstatus *oldpkgstatus= (enum pkgstatus*)argv[1];
 
   if (cleanup_pkg_failed++) return;
   maintainer_script_installed(pkg,POSTINSTFILE,"post-installation",
                               "abort-remove", NULL);
-  pkg->status= stat_installed;
+  pkg->status= *oldpkgstatus;
   pkg->eflag &= ~eflagf_reinstreq;
   modstatdb_note(pkg);
   cleanup_pkg_failed--;
index abcfc9ffaba10e4057ec5ddc5f2a4cc4e814627c..b0fea250ef907f12eeae17d491dcfa98b722cf4c 100644 (file)
@@ -166,9 +166,13 @@ void deferred_remove(struct pkginfo *pkg) {
   if (pkg->status == stat_halfconfigured || pkg->status == stat_installed) {
 
     if (pkg->status == stat_installed || pkg->status == stat_halfconfigured) {
+      static enum pkgstatus oldpkgstatus;
+
+      oldpkgstatus= pkg->status;
       pkg->status= stat_halfconfigured;
       modstatdb_note(pkg);
-      push_cleanup(cu_prermremove,~ehflag_normaltidy, 0,0, 1,(void*)pkg);
+      push_cleanup(cu_prermremove, ~ehflag_normaltidy, 0, 0, 2,
+                   (void *)pkg, (void *)&oldpkgstatus);
       maintainer_script_installed(pkg, PRERMFILE, "pre-removal",
                                   "remove", NULL);
     }