Package: kernel-package Version: 10.050 Followup-For: Bug #342542 I encountered this bug in the latest version of kernel-package in Sid. It seems that the garbage being fed by the postinst hook to debconf causes the exit code to randomly flip between 0 and 128.
According to debconf manuals, stdout is used by debconf and scripts that use debconf and want to display stuff should do so to stderr instead. Attached, you'll find a patch that redirects all the stdout of the postinst hook to stderr so debconf doesn't get confused. Also attached, you'll find a sample application that demonstrates this behavior. -- System Information: Debian Release: testing/unstable APT prefers testing APT policy: (990, 'testing'), (500, 'stable'), (50, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.16-2-k7 Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1) Versions of packages kernel-package depends on: ii dpkg 1.13.21 package maintenance system for Deb ii dpkg-dev 1.13.21 package building tools for Debian ii file 4.17-2 Determines file type using "magic" ii gcc [c-compiler] 4:4.0.3-4 The GNU C compiler ii gcc-3.3 [c-compiler] 1:3.3.6-13 The GNU C compiler ii gcc-4.0 [c-compiler] 4.0.3-3 The GNU C compiler ii gettext 0.14.6-1 GNU Internationalization utilities ii make 3.81-2 The GNU version of the "make" util ii perl 5.8.8-4 Larry Wall's Practical Extraction ii po-debconf 1.0.5 manage translated Debconf template Versions of packages kernel-package recommends: ii bzip2 1.0.3-3 high-quality block-sorting file co ii libc6-dev [libc-dev] 2.3.6-15 GNU C Library: Development Librari -- no debconf information
--- /usr/share/kernel-package/pkg/image/postinst.old 2006-08-03 16:19:55.000000000 +0300 +++ /usr/share/kernel-package/pkg/image/postinst 2006-08-03 16:20:14.000000000 +0300 @@ -1173,7 +1173,7 @@ ## Run user hook script here, if any if (-x "$postinst_hook") { print STDERR "Running postinst hook $postinst_hook.\n"; - system ("$postinst_hook $version $realimageloc$kimage-$version") && + system ("$postinst_hook $version $realimageloc$kimage-$version >&2") && warn "User hook script $postinst_hook failed"; }
simple.pl
Description: Perl program