Package: uswsusp
Version: 0.8-1.1
Severity: normal
Tags: patch

Dear maintainer,

I've prepared an NMU for uswsusp (versioned as 0.8-1.2) and
uploaded it to DELAYED/2. Please free to tell me if I should
delay it longer.

regards,
-mika-
diff -u uswsusp-0.8/debian/uswsusp.postinst uswsusp-0.8/debian/uswsusp.postinst
--- uswsusp-0.8/debian/uswsusp.postinst
+++ uswsusp-0.8/debian/uswsusp.postinst
@@ -42,7 +42,13 @@
 	    # We have to translate the devid to a device file.
 	    if [ "$(awk '$1=="'$dname'" {print $2}' /proc/swaps)" == "file" ];
 	    then
-		devid=$(stat -c "%d" $dname)
+		if ! devid=$(stat -c "%d" $dname) ; then
+			# It is permissible for swap to be a regular file, which
+			# is typically not available in a chroot (and this script
+			# needs to work in chroots too).
+			echo "The swapfile $dname could not be found, exiting." > /dev/stdout
+			exit 0
+		fi
 		devnode="/dev/"$(awk '$1=='$(($devid>>8))' && $2=='$(($devid&0x00ff))' {print $4}' /proc/partitions)
 
 		# This shouldn't happen that much...
diff -u uswsusp-0.8/debian/changelog uswsusp-0.8/debian/changelog
--- uswsusp-0.8/debian/changelog
+++ uswsusp-0.8/debian/changelog
@@ -1,3 +1,12 @@
+uswsusp (0.8-1.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Apply patch by Robert Millan to address the 'postinst fails when
+    running inside a chroot and swap is a regular file' issue.
+    [Closes: #533251, #522319]
+
+ -- Michael Prokop <m...@debian.org>  Sat, 12 Dec 2009 23:19:28 +0100
+
 uswsusp (0.8-1.1) unstable; urgency=low
 
   * Non-maintainer upload to fix pending l10n issues.

Reply via email to