The following commit has been merged in the lenny branch:
commit 587b8d8696cb92a4a18901085db033d44bfe6f32
Author: Guillem Jover <[EMAIL PROTECTED]>
Date: Mon Aug 11 20:22:01 2008 +0300
Fix up packages in an inconsistent triggers-awaited state
When loading the status file fix up any inconsistent package in state
triggers-awaited w/o the corresponding package with pending triggers.
Closes: #487637, #486843, #489068
diff --git a/ChangeLog b/ChangeLog
index 20ff0e5..875dbd6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-08-15 Guillem Jover <[EMAIL PROTECTED]>
+
+ * lib/dpkg-db.h (trig_enqueue_awaited_pend): New function prototype.
+ (trig_fixup_awaiters): Likewise.
+ * lib/dbmodify.c (modstatdb_init): Call trig_fixup_awaiters.
+ * lib/fields.c (f_trigaw): Call trig_enqueue_awaited_pend.
+ * lib/triglib.c (struct pkg_list): New type.
+ (trig_awaited_pend_head): New variable.
+ (trig_enqueue_awaited_pend): New function definition.
+ (trig_fixup_awaiters): Likewise.
+
2008-06-24 Raphael Hertzog <[EMAIL PROTECTED]>
* debian/archtable: Add armel.
diff --git a/debian/changelog b/debian/changelog
index 98e9f02..926a72c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,11 @@ dpkg (1.14.21) UNRELEASED; urgency=low
in DEB_BUILD_OPTIONS (in order to conform with the Debian policy
ruling established in #430649).
+ [ Guillem Jover ]
+ * When loading the status file fix up any inconsistent package in state
+ triggers-awaited w/o the corresponding package with pending triggers.
+ Closes: #487637, #486843, #489068
+
[ Updated scripts translations ]
* Russian (Yuri Kozlov). Closes: #490076
* German (Helge Kreutzmann).
diff --git a/lib/dbmodify.c b/lib/dbmodify.c
index 5c5a431..04231e4 100644
--- a/lib/dbmodify.c
+++ b/lib/dbmodify.c
@@ -196,6 +196,7 @@ enum modstatdb_rw modstatdb_init(const char *adir, enum
modstatdb_rw readwritere
uvb.buf= m_malloc(uvb.size);
}
+ trig_fixup_awaiters(cstatus);
trig_incorporate(cstatus, admindir);
return cstatus;
diff --git a/lib/dpkg-db.h b/lib/dpkg-db.h
index 04ea77d..35345de 100644
--- a/lib/dpkg-db.h
+++ b/lib/dpkg-db.h
@@ -289,6 +289,9 @@ int trig_note_pend(struct pkginfo *pend, char *trig /*not
copied!*/);
int trig_note_aw(struct pkginfo *pend, struct pkginfo *aw);
void trig_clear_awaiters(struct pkginfo *notpend);
+void trig_enqueue_awaited_pend(struct pkginfo *pend);
+void trig_fixup_awaiters(enum modstatdb_rw cstatus);
+
void trig_file_interests_ensure(void);
void trig_file_interests_save(void);
diff --git a/lib/fields.c b/lib/fields.c
index 76d1020..fbb1cc3 100644
--- a/lib/fields.c
+++ b/lib/fields.c
@@ -543,6 +543,8 @@ f_trigaw(struct pkginfo *aw, struct pkginfoperfile *pifp,
if (!trig_note_aw(pend, aw))
parseerr(NULL, filename, lno, warnto, warncount, aw, 0,
_("duplicate awaited trigger package `%.255s'"), word);
+
+ trig_enqueue_awaited_pend(pend);
}
}
diff --git a/lib/triglib.c b/lib/triglib.c
index f86aaf6..d2ab7e8 100644
--- a/lib/triglib.c
+++ b/lib/triglib.c
@@ -169,6 +169,52 @@ trig_clear_awaiters(struct pkginfo *notpend)
}
}
+/* FIXME: switch to use the generic pkg list for lenny+1 */
+struct pkg_list {
+ struct pkg_list *next;
+ struct pkginfo *pkg;
+};
+
+static struct pkg_list *trig_awaited_pend_head;
+
+void
+trig_enqueue_awaited_pend(struct pkginfo *pend)
+{
+ struct pkg_list *tp;
+
+ for (tp = trig_awaited_pend_head; tp; tp = tp->next)
+ if (tp->pkg == pend)
+ return;
+
+ tp = nfmalloc(sizeof(*tp));
+ tp->pkg = pend;
+ tp->next = trig_awaited_pend_head;
+ trig_awaited_pend_head = tp;
+}
+
+/*
+ * Fix up packages in state triggers-awaited w/o the corresponding package
+ * with pending triggers. This can happen when dpkg was interrupted
+ * while in modstatdb_note, and the package in triggers-pending had its
+ * state modified but dpkg could not clearing the awaiters.
+ *
+ * XXX: possibly get rid of some of the checks done somewhere else for
+ * this condition at run-time.
+ */
+void
+trig_fixup_awaiters(enum modstatdb_rw cstatus)
+{
+ struct pkg_list *tp;
+
+ if (cstatus < msdbrw_write)
+ return;
+
+ for (tp = trig_awaited_pend_head; tp; tp = tp->next)
+ if (!tp->pkg->trigpend_head)
+ trig_clear_awaiters(tp->pkg);
+ trig_awaited_pend_head = NULL;
+}
+
/*---------- generalised handling of trigger kinds ----------*/
static const struct trigkindinfo tki_explicit, tki_file, tki_unknown;
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]