Skip to content

Commit

Permalink
vdev_id: use mawk-compatible regular expression
Browse files Browse the repository at this point in the history
Slot mapping in vdev_id doesn't work on systems using mawk as the 'awk'
alternative. A regular expression in map_slot() contains an unquoted
empty string following the alternation (|) operator, which results in an
"missing operand" error with mawk. The solution is to rearrange the
expression so the alternation has two operands.

Signed-off-by: Ned Bass <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes zfsonlinux/pkg-zfs#136
Closes openzfs#2965
  • Loading branch information
nedbass authored and behlendorf committed Dec 19, 2014
1 parent 5c7afad commit 2d9d57b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/vdev_id/vdev_id
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ map_slot() {
local MAPPED_SLOT=

MAPPED_SLOT=`awk "\\$1 == \"slot\" && \\$2 == ${LINUX_SLOT} && \
\\$4 ~ /^(${CHANNEL}|)$/ { print \\$3; exit }" $CONFIG`
\\$4 ~ /^${CHANNEL}$|^$/ { print \\$3; exit }" $CONFIG`
if [ -z "$MAPPED_SLOT" ] ; then
MAPPED_SLOT=$LINUX_SLOT
fi
Expand Down

0 comments on commit 2d9d57b

Please sign in to comment.