tags 289702 patch thanks Attached is a patch that adds a wrapper around update-menus so that it is always executable. The wrapper checks for the existence for /etc/menu/unconfigured, preinst creates it, postinst removes it and runs update-menus. This should fix the bug, I think. Also, eventually it should be possible to get rid of all the testing of whether update-menus is executable in postinsts of other packages.
I have tested the patch by installing woody on a scratch machine (fairly minimal installation, though), then adding ghostview and menu to it, then dist-upgrading to sarge plus a menu package with this patch applied. There were no problems. Admittedly, this is not a through test.
diff -ruN menu-2.1.20.orig/debian/changelog menu-2.1.20.fixed/debian/changelog --- menu-2.1.20.orig/debian/changelog 2004-12-15 01:51:07.000000000 +0200 +++ menu-2.1.20.fixed/debian/changelog 2005-01-17 19:42:45.000000000 +0200 @@ -1,3 +1,14 @@ +menu (2.1.20.0.liw.1) unstable; urgency=low + + * debian/wrapper.sh: Wrote. + * debian/rules: Install debian/wrapper.sh as /usr/bin/update-menus and + what used to be /usr/bin/update-menus as /usr/bin/update-menus.real. + * debian/postinst: When run, remove /etc/menu/unconfigured. + * debian/prerm: Don't fiddle with permission bits. + * debian/preinst: Wrote. + + -- Lars Wirzenius <[EMAIL PROTECTED]> Mon, 17 Jan 2005 19:21:37 +0200 + menu (2.1.20) unstable; urgency=low * The "deer Rudolf" release diff -ruN menu-2.1.20.orig/debian/postinst menu-2.1.20.fixed/debian/postinst --- menu-2.1.20.orig/debian/postinst 2003-10-08 17:44:22.000000000 +0300 +++ menu-2.1.20.fixed/debian/postinst 2005-01-17 19:43:50.000000000 +0200 @@ -13,7 +13,10 @@ # kill -KILL `pidof update-menus` 2> /dev/null || true #fi -chmod a+x /usr/bin/update-menus +# Remove the flag file that prevents update-menus.real from being run while +# its dependency libraries are unconfigured. +rm -f /etc/menu/unconfigured + update-menus install-info --quiet \ diff -ruN menu-2.1.20.orig/debian/preinst menu-2.1.20.fixed/debian/preinst --- menu-2.1.20.orig/debian/preinst 1970-01-01 02:00:00.000000000 +0200 +++ menu-2.1.20.fixed/debian/preinst 2005-01-17 19:41:04.000000000 +0200 @@ -0,0 +1,11 @@ +#!/bin/sh + +# Create the /etc/menu directory. If we're installing for the first time, +# it might be missing, since this script is run before the package is +# unpacked. +install -d /etc/menu + +# Create the flag file that prevents update-menus.real from being run +# by the update-menus shell script. This prevents problems when the +# package is unpacked before its library dependencies have been configured. +touch /etc/menu/unconfigured diff -ruN menu-2.1.20.orig/debian/prerm menu-2.1.20.fixed/debian/prerm --- menu-2.1.20.orig/debian/prerm 2003-10-08 17:38:00.000000000 +0300 +++ menu-2.1.20.fixed/debian/prerm 2005-01-17 19:37:05.000000000 +0200 @@ -2,8 +2,6 @@ set -e -chmod a-x /usr/bin/update-menus - install-info --quiet --remove /usr/share/info/menu.info #DEBHELPER# diff -ruN menu-2.1.20.orig/debian/rules menu-2.1.20.fixed/debian/rules --- menu-2.1.20.orig/debian/rules 2004-05-15 01:30:25.000000000 +0300 +++ menu-2.1.20.fixed/debian/rules 2005-01-17 19:44:53.000000000 +0200 @@ -54,6 +54,9 @@ # Add here commands to install the package into debian/tmp. $(MAKE) install DESTDIR=`pwd`/debian/tmp/ + mv debian/tmp/usr/bin/update-menus debian/tmp/usr/bin/update-menus.real + install debian/wrapper.sh debian/tmp/usr/bin/update-menus + cp examples/translate_menus examples/menu.h po-sections/lang.h\ examples/menu.config debian/tmp/etc/menu-methods # @@ -89,8 +92,6 @@ dh_strip dh_compress dh_fixperms - #Ensure update-menus is not shipped executable - chmod a-x debian/tmp/usr/bin/update-menus # dh_suidregister dh_installdeb dh_shlibdeps diff -ruN menu-2.1.20.orig/debian/wrapper.sh menu-2.1.20.fixed/debian/wrapper.sh --- menu-2.1.20.orig/debian/wrapper.sh 1970-01-01 02:00:00.000000000 +0200 +++ menu-2.1.20.fixed/debian/wrapper.sh 2005-01-17 19:39:45.000000000 +0200 @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Wrapper script around the real update-menus command. This is necessary in +# the Debian context because when packages are updated, the menu.deb package +# may be unpacked before the libraries it is compiled against are unpacked +# and configured. This means that there is a window in time where the new +# update-menus command exists in /usr/bin, but it is not yet usable, because +# the shared libraries don't work. +# +# This wrapper script prevents that from happening: the menu.deb package +# has a pre-installation script that creates /etc/menu/unconfigured before +# the package is unpacked, and a post-installation script that removes the +# file. While the file exists, any attempt to run /usr/bin/update-menus +# (that is, this script) will be a no-op. The menu.deb post-installation +# script runs this script after the package is configured, to make sure +# all the things that should have happened but were turned into no-ops, +# now actually happen. +# +# In more detail: +# +# preinst: touch /etc/menu/unconfigured +# postinst: rm -f /etc/menu/unconfigured; update-menus + +if [ ! -f /etc/menu/unconfigured ] +then + update-menus.real "$@" +fi