Bug#403307: mdadm: initramfs hook has executability test of MDADM slightly wrong

Lionel Elie Mamane lionel at mamane.lu
Sat Dec 16 05:30:43 UTC 2006


Package: mdadm
Version: 2.5.6-7
Severity: normal

/usr/share/initramfs-tools/hooks/mdadm contains the following lines:

 MDADM=$(command -v mdadm 2>/dev/null) || :
 [ -x $MDADM ] || exit 0

The test in the second line evaluates to true if $MDADM is empty
(e.g. if mdadm is not in the $PATH). Replacing it by

 [ -x "$MDADM" ] || exit 0

makes it evaluate to false (and make the script exit) in that case.

More generally, this fails to run the script when mdadm is not in the
path, e.g. when not running mkinitramfs as root (unless $PATH is
manually extended). It would be best to try to have the script behave
as much as possible identically when run as root or not. Maybe you
could append /usr/local/sbin:/usr/sbin/:/sbin to the $PATH at the
beginning of the script?

-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-3-amd64
Locale: LANG=fr_LU.UTF-8, LC_CTYPE=fr_LU.UTF-8 (charmap=UTF-8)

Versions of packages mdadm depends on:
ii  debconf [debconf-2.0]        1.5.10      Debian configuration management sy
ii  libc6                        2.3.6.ds1-9 GNU C Library: Shared libraries
ii  lsb-base                     3.1-22      Linux Standard Base 3.1 init scrip
ii  makedev                      2.3.1-83    creates device files in /dev

Versions of packages mdadm recommends:
ii  exim4-daemon-heavy [mail-tran 4.63-11    exim MTA (v4) daemon with extended
ii  module-init-tools             3.3-pre3-1 tools for managing Linux kernel mo





More information about the pkg-mdadm-devel mailing list