[Pkg-acpi-devel] Bug#593996: acpi-support: resource waste; unnecessary forks and pipes

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Sun Aug 22 21:39:02 UTC 2010

Package: acpi-support
Version: 0.137-5
Severity: normal

This is one example:

lib/device-funcs:6:    bios_version=`cat /sys/class/dmi/id/bios_version|sed -e 's/ *$//'`

Save a fork and a pipe by simply:

bios_version=$(sed -re 's/[[:blank:]]+*$//' /sys/class/dmi/id/bios_version)

This is another:

lib/state-funcs:69:    action=`test "$1" -ne 0 && echo blink || echo off`


if [ $1 -ne 0 ]; then

This is the 3rd:

lib/state-funcs:5:WLAN_RFKILLS=`for RFKILL in /sys/class/rfkill/rfkill*; do if [ $(cat $RFKILL/type) = wlan ]; then echo $RFKILL/state; fi; done`

vs. (builtin 'read' is some 30x faster than a 'cat' fork):

WLAN_RFKILLS=$(for RFKILL in /sys/class/rfkill/rfkill*; do
			read rfk <$RFKILL >/dev/null || :
			[ "$rfk" != wlan ] || echo $RFKILL/state

Similar examples can be found in a lot of other places.

-- System Information:
Debian Release: squeeze/sid
  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 depends on:
ii  acpi-fakekey                  0.137-5    tool to generate fake key events
ii  acpi-support-base             0.137-5    scripts for handling base ACPI eve
ii  acpid                         1:2.0.6-1  Advanced Configuration and Power I
ii  lsb-base                      3.2-23.1   Linux Standard Base 3.2 init scrip
ii  pm-utils                      1.3.0-2    utilities and scripts for power ma
ii  x11-xserver-utils             7.5+2      X server utilities

Versions of packages acpi-support recommends:
ii  dbus                          1.2.24-3   simple interprocess messaging syst
pn  radeontool                    <none>     (no description available)
ii  vbetool                       1.1-2      run real-mode video BIOS code to a
pn  xscreensaver | gnome-screensa <none>     (no description available)

Versions of packages acpi-support suggests:
ii  rfkill                        0.4-1      tool for enabling and disabling wi
ii  xinput                        1.5.2-1    Runtime configuration and test of

-- no debconf information



More information about the Pkg-acpi-devel mailing list