The following commit has been merged in the lenny branch:
commit df21e28ec2ea8bafa47da13101dcd3fa2b76823d
Author: Guillem Jover <[EMAIL PROTECTED]>
Date: Wed Aug 13 21:19:28 2008 +0300
Fix --no-act in triggers related code
Closes: #495097
diff --git a/ChangeLog b/ChangeLog
index 875dbd6..8d85dd5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2008-08-15 Guillem Jover <[EMAIL PROTECTED]>
+ * lib/dbmodify.c (modstatdb_note): Do not call modstatdb_note_core if
+ cstatus does not allow writting. Move the core functionallity to ...
+ (modstatdb_note_core): ... here. New function.
+ * src/help.c (post_postinst_tasks_core): Do not call trig_incorporate
+ if running under --no-act.
+ * src/trigproc.c (trigproc): Do not call maintainer_script_postinst
+ if running under --no-act.
+ (trig_transitional_activate): Do not call trig_file_interests_save
+ if cstatus does not allow writting.
+
+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.
diff --git a/debian/changelog b/debian/changelog
index 926a72c..74f9b96 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,7 @@ dpkg (1.14.21) UNRELEASED; urgency=low
* 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
+ * Fix --no-act in triggers related code. Closes: #495097
[ Updated scripts translations ]
* Russian (Yuri Kozlov). Closes: #490076
diff --git a/lib/dbmodify.c b/lib/dbmodify.c
index 04231e4..6843c2e 100644
--- a/lib/dbmodify.c
+++ b/lib/dbmodify.c
@@ -241,6 +241,41 @@ void modstatdb_shutdown(void) {
free(updatefnbuf);
}
+static void
+modstatdb_note_core(struct pkginfo *pkg)
+{
+ assert(cstatus >= msdbrw_write);
+
+ varbufreset(&uvb);
+ varbufrecord(&uvb, pkg, &pkg->installed);
+
+ if (fwrite(uvb.buf, 1, uvb.used, importanttmp) != uvb.used)
+ ohshite(_("unable to write updated status of `%.250s'"), pkg->name);
+ if (fflush(importanttmp))
+ ohshite(_("unable to flush updated status of `%.250s'"), pkg->name);
+ if (ftruncate(fileno(importanttmp), uvb.used))
+ ohshite(_("unable to truncate for updated status of `%.250s'"), pkg->name);
+ if (fsync(fileno(importanttmp)))
+ ohshite(_("unable to fsync updated status of `%.250s'"), pkg->name);
+ if (fclose(importanttmp))
+ ohshite(_("unable to close updated status of `%.250s'"), pkg->name);
+ sprintf(updatefnrest, IMPORTANTFMT, nextupdate);
+ if (rename(importanttmpfile, updatefnbuf))
+ ohshite(_("unable to install updated status of `%.250s'"), pkg->name);
+
+ /* Have we made a real mess? */
+ assert(strlen(updatefnrest) <= IMPORTANTMAXLEN);
+
+ nextupdate++;
+
+ if (nextupdate > MAXUPDATES) {
+ modstatdb_checkpoint();
+ nextupdate = 0;
+ }
+
+ createimptmp();
+}
+
/* Note: If anyone wants to set some triggers-pending, they must also
* set status appropriately, or we will undo it. That is, it is legal
* to call this when pkg->status and pkg->trigpend_head disagree and
@@ -250,8 +285,6 @@ void modstatdb_shutdown(void) {
void modstatdb_note(struct pkginfo *pkg) {
struct trigaw *ta;
- assert(cstatus >= msdbrw_write);
-
onerr_abort++;
if (pkg->status != stat_triggerspending &&
@@ -268,31 +301,8 @@ void modstatdb_note(struct pkginfo *pkg) {
versiondescribe(&pkg->installed.version, vdew_nonambig));
statusfd_send("status: %s: %s", pkg->name, statusinfos[pkg->status].name);
- varbufreset(&uvb);
- varbufrecord(&uvb, pkg, &pkg->installed);
- if (fwrite(uvb.buf, 1, uvb.used, importanttmp) != uvb.used)
- ohshite(_("unable to write updated status of `%.250s'"), pkg->name);
- if (fflush(importanttmp))
- ohshite(_("unable to flush updated status of `%.250s'"), pkg->name);
- if (ftruncate(fileno(importanttmp), uvb.used))
- ohshite(_("unable to truncate for updated status of `%.250s'"), pkg->name);
- if (fsync(fileno(importanttmp)))
- ohshite(_("unable to fsync updated status of `%.250s'"), pkg->name);
- if (fclose(importanttmp))
- ohshite(_("unable to close updated status of `%.250s'"), pkg->name);
- sprintf(updatefnrest, IMPORTANTFMT, nextupdate);
- if (rename(importanttmpfile, updatefnbuf))
- ohshite(_("unable to install updated status of `%.250s'"), pkg->name);
- assert(strlen(updatefnrest)<=IMPORTANTMAXLEN); /* or we've made a real mess
*/
-
- nextupdate++;
-
- if (nextupdate > MAXUPDATES) {
- modstatdb_checkpoint();
- nextupdate= 0;
- }
-
- createimptmp();
+ if (cstatus >= msdbrw_write)
+ modstatdb_note_core(pkg);
if (!pkg->trigpend_head && pkg->othertrigaw_head) {
/* Automatically remove us from other packages' Triggers-Awaited.
diff --git a/src/help.c b/src/help.c
index 81e9c51..686addb 100644
--- a/src/help.c
+++ b/src/help.c
@@ -239,8 +239,10 @@ post_postinst_tasks_core(struct pkginfo *pkg)
{
modstatdb_note(pkg);
- debug(dbg_triggersdetail, "post_postinst_tasks_core - trig_incorporate");
- trig_incorporate(msdbrw_write, admindir);
+ if (!f_noact) {
+ debug(dbg_triggersdetail, "post_postinst_tasks_core - trig_incorporate");
+ trig_incorporate(msdbrw_write, admindir);
+ }
}
static void
diff --git a/src/trigproc.c b/src/trigproc.c
index b327f5d..29d3a47 100644
--- a/src/trigproc.c
+++ b/src/trigproc.c
@@ -298,9 +298,11 @@ trigproc(struct pkginfo *pkg)
pkg->status = stat_halfconfigured;
modstatdb_note(pkg);
- sincenothing = 0;
- maintainer_script_postinst(pkg, "triggered",
- namesarg.buf + 1, NULL);
+ if (!f_noact) {
+ sincenothing = 0;
+ maintainer_script_postinst(pkg, "triggered",
+ namesarg.buf + 1, NULL);
+ }
/* This is to cope if the package triggers itself: */
pkg->status = pkg->trigaw.head ? stat_triggersawaited :
@@ -361,10 +363,10 @@ trig_transitional_activate(enum modstatdb_rw cstatus)
transitional_interest_callback_ro, NULL, pkg);
}
iterpkgend(it);
- if (cstatus >= msdbrw_write)
+ if (cstatus >= msdbrw_write) {
modstatdb_checkpoint();
-
- trig_file_interests_save();
+ trig_file_interests_save();
+ }
}
/*========== hook setup ==========*/
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]