Bug#337081: multipath-tools: bashism in /etc/udev/scripts/multipath.sh

Clint Adams schizo at debian.org
Wed Nov 2 15:42:10 UTC 2005


Package: multipath-tools
Severity: serious
Justification: Policy 10.4
Tags: patch

${1:0:3} is a bashism.  Here's one way around that.

--- /tmp/multipath.sh	2005-11-02 06:53:18.000000000 -0500
+++ /etc/udev/scripts/multipath.sh	2005-11-02 06:53:11.000000000 -0500
@@ -4,11 +4,12 @@
    exit
 fi
 
-if [ "${1:0:3}" = "dm-" ] ; then
-  dev=$(</sys${DEVPATH}/dev)
-  map=$(/sbin/devmap_name $dev)
-  /sbin/kpartx -v -a /dev/$map
-else
-  /sbin/multipath -v0 /dev/$1
-fi
+case "$1" in
+  (dm-*)
+    dev=$(</sys${DEVPATH}/dev)
+    map=$(/sbin/devmap_name $dev)
+    /sbin/kpartx -v -a /dev/$map
+  (*)
+    /sbin/multipath -v0 /dev/$1
+esac
 




More information about the pkg-lvm-maintainers mailing list