Package: laptop-mode-tools
Version: 1.60-1
Severity: normal
File: /usr/sbin/laptop_mode
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I noticed that my  /var/log/pm-suspend.log always would start with the line

  Module /etc/laptop-mode/modules/* is not executable or is to be skipped.

and missing a lot of expected messages before this line.  Found that the
reason was that I had VERBOSE_OUTPUT enabled in
/etc/laptop-mode/laptop-mode.conf. This makes laptop_mode write messages
to stderr by redirecting to /dev/fd/2

Problem is that if already redirected, like when running from the 
/usr/lib/pm-utils/sleep.d/01laptop-mode hook, then this will truncate
the file stderr is redirected to.  The attached patch fix this by
appending to /dev/fd/2 instead.

This fixes my problem with a truncated /var/log/pm-suspend.log



Bjørn

- -- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (990, 'testing'), (700, 'stable'), (600, 'unstable'), (500, 
'stable-updates'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages laptop-mode-tools depends on:
ii  lsb-base    4.1+Debian0
ii  psmisc      22.16-1
ii  util-linux  2.20.1-4

Versions of packages laptop-mode-tools recommends:
ii  ethtool         1:3.1-1
ii  hdparm          9.39-1
ii  net-tools       1.60-24.1
ii  sdparm          1.06-3
ii  udev            175-3.1
ii  wireless-tools  30~pre9-8

Versions of packages laptop-mode-tools suggests:
pn  acpid  1:2.0.15-2
pn  apmd   3.2.2-14
pn  hal    <none>

- -- Configuration Files:
/etc/laptop-mode/laptop-mode.conf changed [not included]

- -- no debconf information

- -- debsums errors found:
debsums: changed file /usr/sbin/laptop_mode (from laptop-mode-tools package)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAk+IF80ACgkQ10rqkowbIsmdOwCcDLVxbPtsQ//2Re1u1lixNLrX
Ov4An3Y0Z5kyo2EGyr8bTTdfJwkz/kXh
=VQ1+
-----END PGP SIGNATURE-----
--- a/usr/sbin/laptop_mode	2011-10-14 09:40:08.000000000 +0200
+++ b/usr/sbin/laptop_mode	2012-04-13 13:52:28.000000000 +0200
@@ -190,12 +190,12 @@
 fi
 
 if [ "$1" = "VERBOSE" ]; then
-    $LM_VERBOSE &&  echo "$2" >/dev/fd/2;
+    $LM_VERBOSE &&  echo "$2" >>/dev/fd/2;
 elif [ "$1" = "ERR" ]; then
-    echo "$2" >/dev/fd/2;
+    echo "$2" >>/dev/fd/2;
 else
     # Message of type MSG and STATUS can go to stdout.
-    echo "$2" >/dev/fd/1;
+    echo "$2" >>/dev/fd/1;
 fi
 }
 

Reply via email to