[Debian-eeepc-devel] eeepc-acpi-scripts + console + gnu screen ircase?effect

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Mon Apr 12 13:20:37 UTC 2010


On Mon, 12 Apr 2010, Damyan Ivanov wrote:

> Can you try with the following patch applied?
>
> diff --git a/etc/acpi/lib/notify.sh b/etc/acpi/lib/notify.sh
> index b476b53..d602e91 100644
> --- a/etc/acpi/lib/notify.sh
> +++ b/etc/acpi/lib/notify.sh
> @@ -12,7 +12,8 @@ notify() {
>      echo "$MSG"  # for /var/log/acpid
>
>      if [ ! -S /tmp/.X11-unix/X0 ]; then
> -       echo "$MSG" > /dev/console
> +        # echo's behaviour wrt "\r" is shell-dependent
> +       printf "$MSG\r\n" > /dev/console
>         return
>      fi

Is writing to /dev/console a good idea, at all?  joeuser is not
allowed to do that.  This is how that file is listed on my box:

crw------- 1 root root 5, 1 Mar 15 09:23 /dev/console

I also see this (on line 9):

	echo "usage: notify 'category' 'message text' [fast]" > /dev/stderr

Shouldn't that be:

	echo "usage: notify 'category' 'message text' [fast]" >&2

This:

	if [ -n "$4" -o \( -n "$3" -a "$3" != 'fast' \) ]; then
	                 ^                            ^
will fork a subshell.  This:

	if [ "$4" ] || { [ "$3" ] && [ "$3" != fast ];}; then

will not, and is also easier to read, IMO.

What's the use for $4?  It's used in the above expression and never
again.

What does $3 represent?  I see it's tested against the string 'fast'.
I guess $3 may also have the value 'low' :)

Which variables are global?  Which are local?

How smart is to first initialize a variable to the null string:

25	OSD_SHOWN=
26
27	# try to show a nice OSD notification via GNOME OSD service
28	GOSDC=/usr/bin/gnome-osd-client

and then check if it's set to the null string?

29	if [ -z "$OSD_SHOWN" ] && [ -x "$GOSDC" ]; then


Cheers,

-- 
Cristian



More information about the Debian-eeepc-devel mailing list