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

[...]
Errors were encountered while processing:
 uswsusp
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up uswsusp (0.8-1.1+b1) ...
stat: cannot stat `/var/swap': No such file or directory
dpkg: error processing uswsusp (--configure):


See attached patch.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-libre2-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages uswsusp depends on:
ii  debconf [debconf-2.0]         1.5.26     Debian configuration management sy
ii  libc6                         2.9-14     GNU C Library: Shared libraries
ii  libdirectfb-1.2-0             1.2.7-2    direct frame buffer graphics - sha
ii  libgcc1                       1:4.4.0-6  GCC support library
ii  libgcrypt11                   1.4.4-2    LGPL Crypto library - runtime libr
ii  libglib2.0-0                  2.20.3-1   The GLib library of C routines
ii  libgpg-error0                 1.6-1      library for common error values an
pn  liblzo2-2                     <none>     (no description available)
ii  libpci3                       1:3.1.2-5  Linux PCI Utilities (shared librar
pn  libsplashy1                   <none>     (no description available)
ii  libx86-1                      1.1+ds1-2  x86 real-mode library

Versions of packages uswsusp recommends:
pn  initramfs-tools             <none>       (no description available)
ii  mount                       2.15.1~rc1-1 Tools for mounting and manipulatin

Versions of packages uswsusp suggests:
pn  splashy                       <none>     (no description available)
diff -ur uswsusp-0.8/debian/uswsusp.postinst uswsusp-0.8.new/debian/uswsusp.postinst
--- uswsusp-0.8/debian/uswsusp.postinst	2009-06-16 00:33:47.000000000 +0200
+++ uswsusp-0.8.new/debian/uswsusp.postinst	2009-06-16 00:33:18.000000000 +0200
@@ -42,7 +42,12 @@
 	    # 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).
+			exit 0
+		fi
 		devnode="/dev/"$(awk '$1=='$(($devid>>8))' && $2=='$(($devid&0x00ff))' {print $4}' /proc/partitions)
 
 		# This shouldn't happen that much...

Reply via email to