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 <bass6@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1119
# Get path up to /sys/.../hostX
i=1
while [ $i -le $num_dirs ] ; do
# Get path up to /sys/.../hostX
i=1
while [ $i -le $num_dirs ] ; do
scsi_host_dir="$scsi_host_dir/$d"
echo $d | grep -q -E '^host[0-9]+$' && break
i=$(($i + 1))
scsi_host_dir="$scsi_host_dir/$d"
echo $d | grep -q -E '^host[0-9]+$' && break
i=$(($i + 1))
-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
# In sas_switch mode, the directory four levels beneath /sys/.../hostX
# contains symlinks to phy devices that reveal the switch port number. In
i=$(($i + 1))
while [ $i -le $j ] ; do
i=$(($i + 1))
while [ $i -le $j ] ; do
- port_dir="$port_dir/$(eval echo \$$i)"
+ port_dir="$port_dir/$(eval echo \${$i})"
# attribute.
end_device_dir=$port_dir
while [ $i -lt $num_dirs ] ; do
# attribute.
end_device_dir=$port_dir
while [ $i -lt $num_dirs ] ; do
end_device_dir="$end_device_dir/$d"
if echo $d | grep -q '^end_device' ; then
end_device_dir="$end_device_dir/sas_device/$d"
end_device_dir="$end_device_dir/$d"
if echo $d | grep -q '^end_device' ; then
end_device_dir="$end_device_dir/sas_device/$d"