Hi, I'm proposing NMUing dash to fix #546528, which relates to the fact that the preinst script uses a /bin/sh shebang.
For ease of review and to reduce the risk of breaking things at this stage of the cycle, I've chosen the simpler approach of moving the script to use bash as its interpreter instead. Moving it to be ELF - as per bash - might be preferable in the longer run, but at least for the squeeze stable cycle users aren't going to be able to remove bash from their systems in any case. I'm also proposing a few smaller changes to the preinst to make it (more or less) idempotent, as discussed in the bug. Things can probably still go wrong if the install is interrupted between the mv and the divert, but imho that's an improvement relative to the current version. I've attached a debdiff of the changes, which I've verified by installing the package in both lenny and squeeze chroots and as part of an "install" by injecting it in to a local mirror and pointing "cdebootstrap squeeze" at that. (The postinst also has possible idempotency issues, but these seemed more invasive to fix so I've avoided trying to resolve them at this point.) Comments welcome. Regards, Adam
diff -u dash-0.5.5.1/debian/changelog dash-0.5.5.1/debian/changelog --- dash-0.5.5.1/debian/changelog +++ dash-0.5.5.1/debian/changelog @@ -1,3 +1,12 @@ +dash (0.5.5.1-7.3) unstable; urgency=low + + * Non-maintainer upload. + * Modify the preinst to use /bin/bash rather than /bin/sh to avoid having + to rely on /bin/sh being available during unpack. (Closes: #546528) + * Adapt preinst diversion handling to be idempotent. + + -- Adam D. Barratt <a...@adam-barratt.org.uk> Wed, 17 Nov 2010 21:41:30 +0000 + dash (0.5.5.1-7.2) unstable; urgency=low * Non-maintainer upload to correct previous NMU. diff -u dash-0.5.5.1/debian/dash.preinst dash-0.5.5.1/debian/dash.preinst --- dash-0.5.5.1/debian/dash.preinst +++ dash-0.5.5.1/debian/dash.preinst @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e divert() { @@ -6,16 +6,19 @@ ltarget=$2 div=$(dpkg-divert --list $dfile) distrib=${3:-$dfile.distrib} + temp=$dfile.tmp if [ -z "$div" ]; then - dpkg-divert --package dash --divert $distrib --add $dfile # This differs from dpkg-divert's --rename because we # first make a copy of $dfile (the file being diverted) # in $distrib. Then, a symlink to $ltarget is forcibly created - # from $dfile. + # from $dfile; this is performed in two stages with an + # intermediate temporary file as ln -sf is not idempotent. # dpkg-divert's --rename direct equivalent would be: # mv $dfile $distrib -- but we could end up without a symlink cp -dp $dfile $distrib - ln -sf $ltarget $dfile + ln -sf $ltarget $temp + mv -f $temp $dfile + dpkg-divert --package dash --divert $distrib --add $dfile fi }