[Pkg-alsa-devel] Bug#295577: alsa-base: bashism in /etc/init.d/alsa
Sergei Ivanov
Sergei Ivanov <svivanov@pdmi.ras.ru>, 295577@bugs.debian.org
Wed, 16 Feb 2005 23:17:08 +0300
Package: alsa-base
Version: 1.0.8-4
Severity: normal
Tags: patch
The alsa initscript uses
eval $1 --help || ...
to test the presence of a command "$1". However the behavior
of `eval foo || bar' after `set -e' is shell-dependent,
see Bug#268944.
If /bin/sh is dash, and the command in question is amixer,
the script fails immediately due to `amixer --help' returning
exit code 1, and dash's poor handling of eval. If /bin/sh is bash,
the function correctly finds that amixer is present.
While this is arguably a bug in dash and a bug in amixer (non-standard
handling of --help), it's better to avoid this kind of testing in
initscripts. Removing `eval' fixes the problem - its argument
is not going to be expandable anyway.
--- /etc/init.d/alsa.orig 2005-01-31 11:41:21.000000000 +0300
+++ /etc/init.d/alsa 2005-02-16 22:19:47.000000000 +0300
@@ -38,7 +38,7 @@
# See #218530 for a discussion of this issue.
executable()
{
- eval $1 --help > /dev/null 2>&1 || case "$?" in (126|127) return 1 ;; esac
+ $1 --help > /dev/null 2>&1 || case "$?" in (126|127) return 1 ;; esac
return 0
}
--
Best regards,
Sergei
-- System Information:
Debian Release: 3.1
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.8-s1
Locale: LANG=C, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)
Versions of packages alsa-base depends on:
ii alsa-utils 1.0.8-1 ALSA utilities
ii debconf 1.4.30.11 Debian configuration management sy
ii debianutils 2.8.4 Miscellaneous utilities specific t
ii lsof 4.71-1 List open files.
ii module-init-tools 3.2-pre1-2 tools for managing Linux kernel mo
ii modutils 2.4.26-1.2 Linux module utilities
-- debconf information:
alsa-base/alsactl_store_on_shutdown: never autosave