Package: acpi-support
Version: 0.109-5
Severity: important
Tags: patch

The implementation of the dbus-hal suspend method in the
/usr/share/acpi-support/suspendorhibernate script is incorrect.  I've
attached a patch which fixes a number of issues with the
implementation:

 * Currently, it calls the DBUS wrong method and thus reliably fails.
 * stderr was dup'd on to stdout using "2&>1" instead of "2>&1", which
   was passing '2' as an additional argument and redirecting the
   output to a file called '1' instead of the intended effect.
 * The current check for a DBUS error is fragile, since it uses 'grep
   -v' instead of negating the whole condition (that is, currently it
   checks if all output lines are not DBUS errors instead of checking
   that no output lines are DBUS errors, though these appear to be
   equivalent in the current implementation of dbus-send).

I also made the latter two fixes to the dbus-pm method, though I can't
vouch for the correctness of the method being called in that case.


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

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

Versions of packages acpi-support depends on:
ii  acpi-support-base             0.109-5    scripts for handling base ACPI eve
ii  acpid                         1.0.6-10   Utilities for using ACPI power man
ii  dmidecode                     2.9-1      Dump Desktop Management Interface 
ii  finger                        0.17-12    user information lookup program
ii  hdparm                        8.8-1      tune hard disk parameters for high
ii  laptop-detect                 0.13.6     attempt to detect a laptop
ii  libc6                         2.7-12     GNU C Library: Shared libraries
ii  lsb-base                      3.2-12     Linux Standard Base 3.2 init scrip
ii  powermgmt-base                1.30       Common utils and configs for power
ii  vbetool                       1.0-3      run real-mode video BIOS code to a
ii  x11-xserver-utils             7.3+3      X server utilities

Versions of packages acpi-support recommends:
ii  dbus                          1.2.1-2    simple interprocess messaging syst
ii  hal                           0.5.11-2   Hardware Abstraction Layer
pn  nvclock                       <none>     (no description available)
ii  pm-utils                      1.1.2.3-1  utilities and scripts for power ma
pn  radeontool                    <none>     (no description available)

-- no debconf information
--- suspendorhibernate.orig	2008-06-26 00:40:53.000000000 -0700
+++ suspendorhibernate	2008-07-02 01:32:07.000000000 -0700
@@ -73,14 +73,14 @@
 			# Call the power management daemon (which, if it is
 			# running, we probably don't know about, since we send
 			# keys if we detect one running that we know of).
-			if /usr/bin/dbus-send --session \
+			if ! /usr/bin/dbus-send --session \
 			  --dest=org.freedesktop.PowerManagement \
 			  --type=method_call \
 			  --print-reply \
 			  --reply-timeout=2000 \
 			  /org/freedesktop/PowerManagement \
 			  org.freedesktop.PowerManagement.$DBUS_METHOD \
-			  2&>1 | grep -vq " org.freedesktop.DBus.Error." ;
+			  2>&1 | grep -q " org.freedesktop.DBus.Error." ;
 			  then			  
 			  	# Not a DBUS error: other side does exist, and
 			  	# reports an error. That means we don't try
@@ -96,14 +96,14 @@
 	dbus-hal)
 		if [ -x /usr/bin/dbus-send ] ; then
 			# Call HAL directly.
-			if /usr/bin/dbus-send --system \
-			  --dest=org.freedesktop.Hal.Device.SystemPowerManagement \
+			if ! /usr/bin/dbus-send --system \
+			  --dest=org.freedesktop.Hal \
 			  --type=method_call \
 			  --print-reply \
 			  --reply-timeout=2000 \
-			  /org/freedesktop/Hal/Device/SystemPowerManagement \
+			  /org/freedesktop/Hal/devices/computer \
 			  org.freedesktop.Hal.Device.SystemPowerManagement.$DBUS_METHOD $DBUS_PARAMS \
-			  2&>1 | grep -vq " org.freedesktop.DBus.Error." ;
+			  2>&1 | grep -q " org.freedesktop.DBus.Error." ;
 			  then			  
 			  	# Not a DBUS error: other side does exist, and
 			  	# reports an error. That means we don't try

Reply via email to