Skip to content

Commit 910b433

Browse files
arshad512behlendorf
authored andcommitted
vdev_id: variable not getting expanded under map_slot()
Under function map_slot() variable passed as args were not getting properly substituted or expanded. This patch fixes the substitution issue. Reviewed-by: Niklas Edmundsson <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Arshad Hussain <[email protected]> Closes openzfs#11951 Closes openzfs#11959
1 parent 4ac37f8 commit 910b433

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cmd/vdev_id/vdev_id

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ map_slot() {
147147
LINUX_SLOT=$1
148148
CHANNEL=$2
149149

150-
MAPPED_SLOT=$(awk '$1 == "slot" && $2 == "${LINUX_SLOT}" && \
151-
$4 ~ /^${CHANNEL}$|^$/ { print $3; exit}' $CONFIG)
150+
MAPPED_SLOT=$(awk -v linux_slot="$LINUX_SLOT" -v channel="$CHANNEL" \
151+
'$1 == "slot" && $2 == linux_slot && \
152+
($4 ~ "^"channel"$" || $4 ~ /^$/) { print $3; exit}' $CONFIG)
152153
if [ -z "$MAPPED_SLOT" ] ; then
153154
MAPPED_SLOT=$LINUX_SLOT
154155
fi
@@ -163,7 +164,7 @@ map_channel() {
163164
case $TOPOLOGY in
164165
"sas_switch")
165166
MAPPED_CHAN=$(awk -v port="$PORT" \
166-
'$1 == "channel" && $2 == ${PORT} \
167+
'$1 == "channel" && $2 == port \
167168
{ print $3; exit }' $CONFIG)
168169
;;
169170
"sas_direct"|"scsi")

0 commit comments

Comments
 (0)