Package: acpi-support-base
Version: 0.138-5
Severity: normal
Tags: patch

Also, added some documentation and corrected a potential "parameter not set"
shell error which can be caused by a:

      while [ $1 ]; do

when $1 is not set or null.

-- System Information:
Debian Release: 6.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-686 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages acpi-support-base depends on:
ii  acpid                    1:2.0.7-1       Advanced Configuration and Power I
ii  console-tools [console-u 1:0.2.3dbs-69.1 Linux console and font utilities

acpi-support-base recommends no packages.

Versions of packages acpi-support-base suggests:
ii  acpi-support                  0.138-5    scripts for handling many ACPI eve

-- no debconf information


Cheers,

-- 
Cristian
--- debian/acpi-support-base/usr/share/acpi-support/power-funcs.orig	2010-12-19 23:32:58.000000000 +0100
+++ debian/acpi-support-base/usr/share/acpi-support/power-funcs	2010-12-25 15:20:50.000000000 +0100
@@ -10,10 +10,12 @@ pwf_error() {
 	exit 1
 }
 
-# getXuser gets the X user belonging to the display in $displaynum.
-# If you want the foreground X user, use getXconsole!
-
+# getXuser gets the X user belonging to the display in the global variable
+# $displaynum. If you want the foreground X user, use getXconsole!
+# getXuser exports the XAUTHORITY and XUSER variables.
 getXuser() {
+	local plist user l lastpp ds startx pid userhome
+
 	plist=$(pinky -fw) || pwf_error "pinky lost"
 	user=
 	while read l; do
@@ -63,7 +65,11 @@ getXuser() {
 }
 
 # getXconsole gets the foreground (console) X user
+# getXconsole exports the DISPLAY variable and indirectly the XAUTHORITY and
+# XUSER variables, as it calls getXuser at some point.
 getXconsole() {
+	local activeVT cmdl xproc displaynum
+
 	activeVT=$(fgconsole) || pwf_error "can't get active VT"
 	case $activeVT in
 		serial)
@@ -99,7 +105,7 @@ getXconsole() {
 			# match the 1st of the remaining positional parameters that looks like
 			# a display number
 			displaynum=
-			while [ $1 ]; do
+			while [ $# -gt 0 ]; do
 				case $1 in
 					:[0-9]*)
 						displaynum=$1
@@ -125,12 +131,17 @@ getXconsole() {
 }
 
 ac_adapters() {
+    local x type
+
     for x in /sys/class/power_supply/*; do
 	[ ! -d "$x" ] || ! read type <$x/type || [ "$type" != Mains ] || echo $x
     done
 }
 
+# getState side effect: sets global variable STATE
 getState() {
+	local ONLINE_POWER_SUPPLY_PRESENT POWER_SUPPLY_PRESENT x _olpsp
+
 	# Run through all power supply information. If we have only one that is online,
         # then we are on AC power. If we find no power supplies at all, then we assume
         # that we are on a desktop machine without power supply information and we are
@@ -160,6 +171,8 @@ getState() {
         
 #check our state has actually changed
 checkStateChanged() {
+	local OLDSTATE
+
 # do we have our state stashed?
 # XXX:	if vaiable STATE is unset, set it to the null string
 	: ${STATE=${STATE:-}}

Reply via email to