The following commit has been merged in the iwj branch:
commit f1f5a979d17d531a57c8a6e232eeb2642a4862d5
Author: Ian Jackson <[EMAIL PROTECTED]>
Date: Wed Oct 31 16:18:22 2007 +0000
* postinst in cleanup iff status was good beforehand. Closes: #432893.
This is the proper fix. If the package was halfconfigured, we
don't run the postinst and that way there are no surprises.
When we do run the postinst we know that we can without fear set
the package to installed (or trig*, as the case may be).
We achieve this by not registering the cu_prerm* handlers unless the
package was >stat_halfconfigured beforehand. We have no more need
to pass the previous state into the cu_prerm* postinst invocations.
diff --git a/debian/changelog b/debian/changelog
index f99e415..f0d99cb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -67,8 +67,14 @@ dpkg (1.14.8) UNRELEASED; urgency=low
* Polish (Robert Luberda).
[ Ian Jackson ]
- * Treat successful calls to the postinst as always making the package
- installed. Reverts Brian Carlson's patch from #432893.
+ * postinst in cleanup iff status was good beforehand. Closes: #432893.
+ This is the proper fix. If the package was halfconfigured, we
+ don't run the postinst and that way there are no surprises.
+ When we do run the postinst we know that we can without fear set
+ the package to installed (or trig*, as the case may be).
+ We achieve this by not registering the cu_prerm* handlers unless the
+ package was >stat_halfconfigured beforehand. We have no more need
+ to pass the previous state into the cu_prerm* postinst invocations.
* Run prerms during removal even if the package is in a trig* state.
* Do not pointlessly clear reinstreq flag on postinst abort-remove.
cu_prermremove is only be called via a push_cleanup in remove.c which
diff --git a/src/processarc.c b/src/processarc.c
index 878e629..cf9d3e1 100644
--- a/src/processarc.c
+++ b/src/processarc.c
@@ -399,7 +399,8 @@ void process_archive(const char *filename) {
oldversionstatus == stat_installed) {
pkg->status= stat_halfconfigured;
modstatdb_note(pkg);
- push_cleanup(cu_prermupgrade,~ehflag_normaltidy, 0,0, 1,(void*)pkg);
+ if (oldversionstatus > stat_halfconfigured)
+ push_cleanup(cu_prermupgrade,~ehflag_normaltidy, 0,0, 1,(void*)pkg);
maintainer_script_alternative(pkg, PRERMFILE, "pre-removal", cidir,
cidirrest,
"upgrade", "failed-upgrade");
pkg->status= stat_unpacked;
@@ -416,6 +417,7 @@ void process_archive(const char *filename) {
else
printf(_("De-configuring %s ...\n"), deconpil->pkg->name);
+ assert(deconpil->pkg->status > stat_halfconfigured);
trig_activate_packageprocessing(deconpil->pkg);
deconpil->pkg->status= stat_halfconfigured;
modstatdb_note(deconpil->pkg);
@@ -447,15 +449,18 @@ void process_archive(const char *filename) {
}
for (i = 0 ; i < cflict_index; i++) {
- if (!(conflictor[i]->status == stat_halfconfigured ||
- conflictor[i]->status == stat_triggersawaited ||
- conflictor[i]->status == stat_triggerspending ||
- conflictor[i]->status == stat_installed)) continue;
+ enum pkgstatus conflictoroldstatus= conflictor[i]->status;
+ if (!(conflictoroldstatus == stat_halfconfigured ||
+ conflictoroldstatus == stat_triggersawaited ||
+ conflictoroldstatus == stat_triggerspending ||
+ conflictoroldstatus == stat_installed)) continue;
trig_activate_packageprocessing(conflictor[i]);
conflictor[i]->status= stat_halfconfigured;
modstatdb_note(conflictor[i]);
- push_cleanup(cu_prerminfavour,~ehflag_normaltidy, 0,0,
- 2,(void*)conflictor[i],(void*)pkg);
+
+ if (conflictoroldstatus > stat_halfconfigured)
+ push_cleanup(cu_prerminfavour,~ehflag_normaltidy, 0,0,
+ 2,(void*)conflictor[i],(void*)pkg);
maintainer_script_installed(conflictor[i], PRERMFILE, "pre-removal",
"remove", "in-favour", pkg->name,
versiondescribe(&pkg->available.version,
diff --git a/src/remove.c b/src/remove.c
index e96c5d0..4394b36 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -168,9 +168,11 @@ void deferred_remove(struct pkginfo *pkg) {
log_action("remove", pkg);
trig_activate_packageprocessing(pkg);
if (pkg->status >= stat_halfconfigured) {
+ enum pkgstatus oldstatus= pkg->status;
pkg->status= stat_halfconfigured;
modstatdb_note(pkg);
- push_cleanup(cu_prermremove,~ehflag_normaltidy, 0,0, 1,(void*)pkg);
+ if (oldstatus > stat_halfconfigured)
+ push_cleanup(cu_prermremove,~ehflag_normaltidy, 0,0, 1,(void*)pkg);
maintainer_script_installed(pkg, PRERMFILE, "pre-removal",
"remove", (char*)0);
pkg->status= stat_unpacked; /* Will turn into halfinstalled soon ... */
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]