Package: eeepc-acpi-scripts
Version: 1.1.0
Severity: normal
Tags: patch

Hello,

I had some problems with my Eee PC 901, that does not have a bluetooth
kill switch in /proc/ or /sys/: even if there is a modprobe-based
fallback, pressing the corresponding hotkey always left it enabled.

I finally found the problem: $BT_CTL was empty, and tested with
[ -e $BT_CTL ], that (with dash as /bin/sh) is [ -e ], that is... true!
"$BT_CTL" (the empty string) should be used instead of $BT_CTL
(nothing).

I found several such tests to be corrected: here is a global, recursive
patch over them.

Regards,

-- 
Tanguy Ortolo
-- System Information:
Debian Release: 5.0.1
  APT prefers stable
  APT policy: (990, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -ru eeepc-acpi-scripts-1.1.0.old/etc/acpi/actions/hotkey.sh eeepc-acpi-scripts-1.1.0/etc/acpi/actions/hotkey.sh
--- eeepc-acpi-scripts-1.1.0.old/etc/acpi/actions/hotkey.sh	2009-06-10 15:29:00.000000000 +0200
+++ eeepc-acpi-scripts-1.1.0/etc/acpi/actions/hotkey.sh	2009-06-10 15:28:17.000000000 +0200
@@ -4,7 +4,7 @@
 PKG=eeepc-acpi-scripts
 FUNC_LIB=/usr/share/$PKG/functions.sh
 DEFAULT=/etc/default/$PKG
-[ -e $FUNC_LIB ] || exit 0
+[ -e "$FUNC_LIB" ] || exit 0
 
 case $(runlevel) in
     *0|*6)
@@ -59,7 +59,7 @@
 
 handle_bluetooth_toggle() {
     . /etc/acpi/lib/bluetooth.sh
-    if [ -e $BT_CTL ] || [ "$BLUETOOTH_FALLBACK_TO_HCITOOL" = "yes" ]; then
+    if [ -e "$BT_CTL" ] || [ "$BLUETOOTH_FALLBACK_TO_HCITOOL" = "yes" ]; then
 	toggle_bluetooth
 	show_bluetooth
     else
@@ -77,7 +77,7 @@
 
 handle_camera_toggle() {
     . /etc/acpi/lib/camera.sh
-    if [ -e $CAM_CTL ]; then
+    if [ -e "$CAM_CTL" ]; then
 	toggle_camera
 	show_camera
     else
diff -ru eeepc-acpi-scripts-1.1.0.old/etc/acpi/actions/suspend.sh eeepc-acpi-scripts-1.1.0/etc/acpi/actions/suspend.sh
--- eeepc-acpi-scripts-1.1.0.old/etc/acpi/actions/suspend.sh	2009-06-10 15:29:00.000000000 +0200
+++ eeepc-acpi-scripts-1.1.0/etc/acpi/actions/suspend.sh	2009-06-10 15:42:24.000000000 +0200
@@ -2,7 +2,7 @@
 
 # do nothing if package is removed
 FUNC_LIB=/usr/share/eeepc-acpi-scripts/functions.sh
-[ -e $FUNC_LIB ] || exit 0
+[ -e "$FUNC_LIB" ] || exit 0
 
 . /etc/default/eeepc-acpi-scripts
 . $FUNC_LIB
diff -ru eeepc-acpi-scripts-1.1.0.old/etc/acpi/actions/vga-toggle.sh eeepc-acpi-scripts-1.1.0/etc/acpi/actions/vga-toggle.sh
--- eeepc-acpi-scripts-1.1.0.old/etc/acpi/actions/vga-toggle.sh	2009-06-10 15:29:00.000000000 +0200
+++ eeepc-acpi-scripts-1.1.0/etc/acpi/actions/vga-toggle.sh	2009-06-10 15:33:02.000000000 +0200
@@ -4,7 +4,7 @@
 PKG=eeepc-acpi-scripts
 FUNC_LIB=/usr/share/$PKG/functions.sh
 DEFAULT=/etc/default/$PKG
-[ -e $FUNC_LIB ] || exit 0
+[ -e "$FUNC_LIB" ] || exit 0
 
 if [ -e "$DEFAULT" ]; then . "$DEFAULT"; fi
 . $FUNC_LIB
diff -ru eeepc-acpi-scripts-1.1.0.old/etc/acpi/actions/volume.sh eeepc-acpi-scripts-1.1.0/etc/acpi/actions/volume.sh
--- eeepc-acpi-scripts-1.1.0.old/etc/acpi/actions/volume.sh	2009-06-10 15:29:00.000000000 +0200
+++ eeepc-acpi-scripts-1.1.0/etc/acpi/actions/volume.sh	2009-06-10 15:33:14.000000000 +0200
@@ -6,7 +6,7 @@
 PKG=eeepc-acpi-scripts
 FUNC_LIB=/usr/share/$PKG/functions.sh
 DEFAULT=/etc/default/$PKG
-[ -e $FUNC_LIB ] || exit 0
+[ -e "$FUNC_LIB" ] || exit 0
 
 . $FUNC_LIB
 . /etc/acpi/lib/notify.sh
diff -ru eeepc-acpi-scripts-1.1.0.old/etc/acpi/actions/wireless.sh eeepc-acpi-scripts-1.1.0/etc/acpi/actions/wireless.sh
--- eeepc-acpi-scripts-1.1.0.old/etc/acpi/actions/wireless.sh	2009-06-10 15:29:00.000000000 +0200
+++ eeepc-acpi-scripts-1.1.0/etc/acpi/actions/wireless.sh	2009-06-10 15:42:42.000000000 +0200
@@ -7,7 +7,7 @@
 
 [ -n "$wlan_control" -a -e "$wlan_control" ] \
     || wlan_control=/sys/devices/platform/eeepc/wlan # pre-2.6.28
-[ -e $wlan_control ] || wlan_control=/proc/acpi/asus/wlan # pre-2.6.26
+[ -e "$wlan_control" ] || wlan_control=/proc/acpi/asus/wlan # pre-2.6.26
 
 STATE="$(cat $wlan_control)"
 
diff -ru eeepc-acpi-scripts-1.1.0.old/etc/acpi/lib/bluetooth.sh eeepc-acpi-scripts-1.1.0/etc/acpi/lib/bluetooth.sh
--- eeepc-acpi-scripts-1.1.0.old/etc/acpi/lib/bluetooth.sh	2009-06-10 15:29:00.000000000 +0200
+++ eeepc-acpi-scripts-1.1.0/etc/acpi/lib/bluetooth.sh	2009-06-10 15:30:51.000000000 +0200
@@ -4,8 +4,8 @@
 
 detect_rfkill eeepc-bluetooth
 BT_CTL="$RFKILL"
-[ -e $BT_CTL ] || BT_CTL=/sys/devices/platform/eeepc/bluetooth # pre-2.6.28
-[ -e $BT_CTL ] || BT_CTL=/proc/acpi/asus/bluetooth # pre-2.6.26
+[ -e "$BT_CTL" ] || BT_CTL=/sys/devices/platform/eeepc/bluetooth # pre-2.6.28
+[ -e "$BT_CTL" ] || BT_CTL=/proc/acpi/asus/bluetooth # pre-2.6.26
 # check if bluetooth is switched on and return success (exit code 0 if it is
 # return failure (exit code 1) if it is not
 #
@@ -13,7 +13,7 @@
 # if not, uses hcitool to see if there is a hci0 device
 bluetooth_is_on()
 {
-    if [ -e $BT_CTL ]; then
+    if [ -e "$BT_CTL" ]; then
         [ $( cat $BT_CTL ) = "1" ]
     else
         if [ "$BLUETOOTH_FALLBACK_TO_HCITOOL" = "yes" ]; then
@@ -27,7 +27,7 @@
 toggle_bluetooth()
 {
     if bluetooth_is_on; then
-        if [ -e $BT_CTL ]; then
+        if [ -e "$BT_CTL" ]; then
             echo 0 > $BT_CTL
             # udev should unload the module now
         elif [ "$BLUETOOTH_FALLBACK_TO_HCITOOL" = "yes" ]; then
@@ -40,7 +40,7 @@
 	    done
         fi
     else
-        if [ -e $BT_CTL ]; then
+        if [ -e "$BT_CTL" ]; then
             echo 1 > $BT_CTL
             # udev should load the module now
         elif [ "$BLUETOOTH_FALLBACK_TO_HCITOOL" = "yes" ]; then
diff -ru eeepc-acpi-scripts-1.1.0.old/etc/acpi/lib/camera.sh eeepc-acpi-scripts-1.1.0/etc/acpi/lib/camera.sh
--- eeepc-acpi-scripts-1.1.0.old/etc/acpi/lib/camera.sh	2009-06-10 15:29:00.000000000 +0200
+++ eeepc-acpi-scripts-1.1.0/etc/acpi/lib/camera.sh	2009-06-10 15:32:47.000000000 +0200
@@ -3,7 +3,7 @@
 # to be sourced
 
 CAM_CTL=/sys/devices/platform/eeepc/camera
-[ -e $CAM_CTL ] || CAM_CTL=/proc/acpi/asus/camera #pre-2.6.26
+[ -e "$CAM_CTL" ] || CAM_CTL=/proc/acpi/asus/camera #pre-2.6.26
 # check if camera is enabled and return success (exit code 0 if it is
 # return failure (exit code 1) if it is not
 #
@@ -11,7 +11,7 @@
 # if not, assume there is not camera and return false
 camera_is_on()
 {
-    if [ -e $CAM_CTL ]; then
+    if [ -e "$CAM_CTL" ]; then
         [ $( cat $CAM_CTL ) = "1" ]
     else
         false
@@ -23,7 +23,7 @@
     if camera_is_on; then
         echo 0 > $CAM_CTL
     else
-        if [ -e $CAM_CTL ]; then
+        if [ -e "$CAM_CTL" ]; then
             echo 1 > $CAM_CTL
         fi
     fi
diff -ru eeepc-acpi-scripts-1.1.0.old/etc/acpi/lib/notify.sh eeepc-acpi-scripts-1.1.0/etc/acpi/lib/notify.sh
--- eeepc-acpi-scripts-1.1.0.old/etc/acpi/lib/notify.sh	2009-06-10 15:29:00.000000000 +0200
+++ eeepc-acpi-scripts-1.1.0/etc/acpi/lib/notify.sh	2009-06-10 15:54:19.000000000 +0200
@@ -21,7 +21,7 @@
 
     # try to show a nice OSD notification via GNOME OSD service
     GOSDC=/usr/bin/gnome-osd-client
-    if [ -z "$OSD_SHOWN" ] && [ -x $GOSDC ]; then
+    if [ -z "$OSD_SHOWN" ] && [ -x "$GOSDC" ]; then
 	if ps -u $user -o cmd= | grep -q '^/usr/bin/python /usr/bin/gnome-osd-event-bridge'; then
 	    if echo "$MSG" | grep -q '[0-9]'; then
 		animations='off'
diff -ru eeepc-acpi-scripts-1.1.0.old/functions.sh eeepc-acpi-scripts-1.1.0/functions.sh
--- eeepc-acpi-scripts-1.1.0.old/functions.sh	2009-06-10 15:29:00.000000000 +0200
+++ eeepc-acpi-scripts-1.1.0/functions.sh	2009-06-10 15:54:44.000000000 +0200
@@ -57,7 +57,7 @@
     fi
     _home=$(getent passwd $_user | cut -d: -f6)
     XAUTHORITY=$_home/.Xauthority
-    if [ -f $XAUTHORITY ]; then
+    if [ -f "$XAUTHORITY" ]; then
         export XAUTHORITY
         export DISPLAY=:0
         user=$_user
@@ -75,7 +75,7 @@
     # activate screensaver if available
     if [ -S /tmp/.X11-unix/X0 ]; then
         detect_x_display
-        if [ -f $XAUTHORITY ]; then
+        if [ -f "$XAUTHORITY" ]; then
             for ss in xscreensaver gnome-screensaver; do
                 [ -x /usr/bin/$ss-command ] \
                     && pidof /usr/bin/$ss > /dev/null \
_______________________________________________
Debian-eeepc-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/debian-eeepc-devel

Reply via email to