[Pkg-alsa-devel] Bug#247109: alsa-base: apm script exits with nonzero status

Marius Gedminas Marius Gedminas <mgedmin@b4net.lt>, 247109@bugs.debian.org
Mon, 3 May 2004 14:35:59 +0300

Package: alsa-base
Version: 1.0.4-3
Severity: normal

/etc/init.d/apm can exit with nonzero status code and prevent other APM
scripts from being run (this broke laptop-net on my machine).  The
reason is that fuser returns a nonzero status code when there are no
processes that are using sound devices.

Proposed fix:

--- /etc/apm/event.d/alsa.dpkg-dist   2004-05-02 13:50:34.000000000 +0300
+++ /etc/apm/event.d/alsa        2004-05-03 14:33:27.000000000 +0300
@@ -7,12 +7,12 @@
 devices=$(find /dev -type c | xargs stat -c '%t %n' | sed -n 's/^e //p; s/^74 //p')
 if [ "$1" = suspend ]; then
     if [ -d /proc/asound ]; then
-       fuser -k -STOP $devices
+       fuser -k -STOP $devices || true
     sleep 1
 elif [ "$1" = resume ]; then
     if [ -d /proc/asound ]; then
-       fuser -k -CONT $devices
+       fuser -k -CONT $devices || true

Also, is that 'sleep 1' line really necessary?  If it is, shouldn't it
be moved inside 'if [ -d /proc/asound ]'?

-- System Information:
Debian Release: 3.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.4.24-mg2
Locale: LANG=C, LC_CTYPE=lt_LT.UTF-8

Versions of packages alsa-base depends on:
ii  alsa-utils                   1.0.4-1     Advanced Linux Sound Architecture 
ii  debconf                      1.4.25      Debian configuration management sy
ii  debianutils                  2.8.1       Miscellaneous utilities specific t
ii  module-init-tools            3.0-pre10-2 tools for managing Linux kernel mo
ii  modutils                     2.4.26-1    Linux module utilities
ii  psmisc                       21.4-1      Utilities that use the proc filesy

-- debconf information excluded

Marius Gedminas
Read what I mean, not what I write.