Package: dpkg
Version: 1.15.5.6ubuntu2
Severity: normal
While looking at a ubuntu upgrade failure report I noticed that dpkg
does not report deferred trigger failures as real errors via the
status-fd or via the terminal output. Here is a example:
apt-term.log
...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-2.6.24-27-generic
cpio: ./etc/modprobe.d/arch-aliases: Cannot stat: No such file or directory
update-initramfs: failed for /boot/initrd.img-2.6.24-27-generic
dpkg: subprocess installed post-installation script returned error exit status 1
....
This error was not reported on the status-fd, instead much later in
the chain dmsetup failed because initramfs-tools goes into
half-configured state.
This error is reported on the status-fd because initramfs-tools is now
in half-configured state because the trigger failed earlier. This is
misleading when looking a bugs and conceptually it should be the same
kind of error as a normal postinst failure because it has the same
consequences. I report this problem from a Ubuntu machine, but Debian
has the same code.
Attached is a possible patch. I have tested it and it works for me,
but my knowledge of the dpkg error handling code is not great, so a
review is appreciated.
Cheers,
Michael
-- System Information:
Debian Release: squeeze/sid
APT prefers lucid
APT policy: (500, 'lucid')
Architecture: i386 (i686)
Kernel: Linux 2.6.32-16-generic (SMP w/2 CPU cores)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages dpkg depends on:
ii coreutils 7.4-2ubuntu2 The GNU core utilities
ii libc6 2.11.1-0ubuntu4 Embedded GNU C Library: Shared lib
ii lzma 4.43-14ubuntu2 Compression method of 7z format in
dpkg recommends no packages.
Versions of packages dpkg suggests:
hi apt 0.7.25.4ubuntu1 Advanced front-end for dpkg
-- no debconf information
diff -Nru dpkg-1.15.5.6ubuntu3/src/trigproc.c dpkg-1.15.5.6ubuntu4/src/trigproc.c
--- dpkg-1.15.5.6ubuntu3/src/trigproc.c 2010-03-16 11:29:49.000000000 +0100
+++ dpkg-1.15.5.6ubuntu4/src/trigproc.c 2010-03-18 10:22:21.000000000 +0100
@@ -103,6 +103,7 @@
{
struct pkg_list *node;
struct pkginfo *pkg;
+ jmp_buf ejbuf;
debug(dbg_triggers, "trigproc_run_deferred");
while ((node = remove_from_some_queue(&deferred))) {
@@ -110,8 +111,18 @@
free(node);
if (!pkg)
continue;
+
+ if (setjmp(ejbuf)) {
+ error_unwind(ehflag_bombout);
+ }
+ push_error_handler(&ejbuf,print_error_perpackage, pkg->name);
+
pkg->clientdata->trigprocdeferred = NULL;
trigproc(pkg);
+
+ set_error_display(NULL, NULL);
+ error_unwind(ehflag_normaltidy);
+
}
}