diff options
author | Cyril Plisko <[email protected]> | 2012-11-29 15:40:26 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2012-11-29 13:07:47 -0800 |
commit | 38b344d22a80a173e50ab992f81b57b872e6da7c (patch) | |
tree | 038d605decd3b4151e4cd23b3ce4f49778796769 /cmd/vdev_id | |
parent | a6ef9522eae9be2c2cb40731a8afb0a90f05d7ae (diff) |
vdev_id fails to handle complex device topologies
While expanding positional parameters shell requires non-single
digits to be enclosed in braces. When the SAS topology is
non-trivial the number of positional parameters generated internally
by vdev_id script (using set -- ...) easily crosses single digit limit
and vdev_id fails to generate links.
Signed-off-by: Ned Bass <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #1119
Diffstat (limited to 'cmd/vdev_id')
-rwxr-xr-x | cmd/vdev_id/vdev_id | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd/vdev_id/vdev_id b/cmd/vdev_id/vdev_id index fd8e42289..d133e162d 100755 --- a/cmd/vdev_id/vdev_id +++ b/cmd/vdev_id/vdev_id @@ -236,7 +236,7 @@ scsi_host_dir="/sys" # Get path up to /sys/.../hostX i=1 while [ $i -le $num_dirs ] ; do - d=$(eval echo \$$i) + d=$(eval echo \${$i}) scsi_host_dir="$scsi_host_dir/$d" echo $d | grep -q -E '^host[0-9]+$' && break i=$(($i + 1)) @@ -246,7 +246,7 @@ if [ $i = $num_dirs ] ; then exit 0 fi -PCI_ID=$(eval echo \$$(($i -1)) | awk -F: '{print $2":"$3}') +PCI_ID=$(eval echo \${$(($i -1))} | awk -F: '{print $2":"$3}') # In sas_switch mode, the directory four levels beneath /sys/.../hostX # contains symlinks to phy devices that reveal the switch port number. In @@ -259,7 +259,7 @@ esac i=$(($i + 1)) while [ $i -le $j ] ; do - port_dir="$port_dir/$(eval echo \$$i)" + port_dir="$port_dir/$(eval echo \${$i})" i=$(($i + 1)) done @@ -273,7 +273,7 @@ PORT=$(( $PHY / $PHYS_PER_PORT )) # attribute. end_device_dir=$port_dir while [ $i -lt $num_dirs ] ; do - d=$(eval echo \$$i) + d=$(eval echo \${$i}) end_device_dir="$end_device_dir/$d" if echo $d | grep -q '^end_device' ; then end_device_dir="$end_device_dir/sas_device/$d" |