Package: laptop-mode-tools
Version: 1.32-1
Severity: normal
Tags: patch

*** Please type your report below this line ***

laptop_mode does not expand any wild cards used with PARTITIONS variable
properly, so LVM partitions are not remounted with powersaving
options, even though it set to "auto /dev/mapper/*" by default.
Here's an example with debug output enabled:

# /etc/init.d/laptop-mode start | grep home
/dev/mapper/silun_levyt-home not found in PARTITIONS.
/home not found in PARTITIONS.
Checking /dev/mapper/silun_levyt-home against HD because PARTITIONS
contains "auto".

The problem is quite simple, though I don't understand the reasons for the
laptop_mode coding style with environment variables. With the fix below
I get LVM partitions remounted:

# /etc/init.d/laptop-mode start|grep home
/dev/mapper/silun_levyt-home found in PARTITIONS.
/home not found in PARTITIONS.
Checking /dev/mapper/silun_levyt-home against HD because PARTITIONS
contains "auto".
Executing: mount /dev/mapper/silun_levyt-home -t ext3 /home -o
remount,rw,commit=360
Executing: /sbin/blockdev --setra 6144 /dev/mapper/silun_levyt-home

And the patch:

--- laptop-mode-tools-1.32.orig/usr/sbin/laptop_mode
+++ laptop-mode-tools-1.32/usr/sbin/laptop_mode
@@ -966,19 +966,27 @@
                echo "Remounting filesystems." >> $OUTPUT
                cat /etc/mtab | while read DEV MP FST OPTS DUMP PASS ; do
                        DO=0
-                       if ( echo " $PARTITIONS " | grep " $DEV " > /dev/null ) 
; then
+                       # $PARTITIONS may contain shell wild cards like
+                       # /dev/mapper/* , so the shell needs to expand them 
+                       # before grep matching, thus no quoting with echo and
+                       # no white space matches with grep.
+                       # Perhaps there is a good reason for this
+                       # style? Perhaps no variable should have wild cards or
+                       # perhaps all wild cards should be expanded somewhere 
+                       # else where its safe?
+                       if ( echo $PARTITIONS | grep "$DEV" > /dev/null ) ; then
                                DO=1
                                echo "$DEV found in PARTITIONS." >> $OUTPUT
                        else
                                echo "$DEV not found in PARTITIONS." >> $OUTPUT
                        fi
-                       if ( echo " $PARTITIONS " | grep " $MP " > /dev/null ) 
; then
+                       if ( echo $PARTITIONS | grep "$MP" > /dev/null ) ; then
                                DO=1
                                echo "$MP found in PARTITIONS." >> $OUTPUT
                        else
                                echo "$MP not found in PARTITIONS." >> $OUTPUT
                        fi
-                       if ( echo " $PARTITIONS " | grep " auto " > /dev/null ) 
; then
+                       if ( echo $PARTITIONS | grep "auto" > /dev/null ) ; then
                                echo "Checking $DEV against HD because 
PARTITIONS contains \"auto\"." >> $OUTPUT
                                for THISHD in $HD ; do
                                        echo "   Considering $THISHD." >> 
$OUTPUT

-- System Information:
Debian Release: testing
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-2-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages laptop-mode-tools depends on:
ii  lsb-base                      3.1-15     Linux Standard Base 3.1 init scrip

Versions of packages laptop-mode-tools recommends:
ii  acpid                         1.0.4-5    Utilities for using ACPI power man
ii  hdparm                        6.6-1      tune hard disk parameters for high
pn  sdparm                        <none>     (no description available)

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to