tags 546528 + pending
thanks

Dear maintainer,

I've prepared an NMU for dash (versioned as 0.5.5.1-7.3) and
uploaded it to DELAYED/1. Please feel free to tell me if I
should delay it longer.

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,13 @@
+dash (0.5.5.1-7.3) unstable; urgency=medium
+
+  * 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; thanks to
+    Jonathan Nieder.
+
+ -- 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 atomic.
 		# 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
 }
 

Reply via email to