|
|
b46d12 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
b46d12 |
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
b46d12 |
Date: Fri, 9 Jul 2021 14:30:10 -0500
|
|
|
b46d12 |
Subject: [PATCH] RH: mpathconf: correctly handle spaces after option names
|
|
|
b46d12 |
|
|
|
b46d12 |
mpathconf was either accepting any number of spaces, including zero,
|
|
|
b46d12 |
after option names, or it was only accepting one space. It should
|
|
|
b46d12 |
accept one or more spaces.
|
|
|
b46d12 |
|
|
|
b46d12 |
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
b46d12 |
---
|
|
|
b46d12 |
multipath/mpathconf | 40 ++++++++++++++++++++--------------------
|
|
|
b46d12 |
1 file changed, 20 insertions(+), 20 deletions(-)
|
|
|
b46d12 |
|
|
|
b46d12 |
diff --git a/multipath/mpathconf b/multipath/mpathconf
|
|
|
b46d12 |
index 2f4f3eaf..5f2285ab 100644
|
|
|
b46d12 |
--- a/multipath/mpathconf
|
|
|
b46d12 |
+++ b/multipath/mpathconf
|
|
|
b46d12 |
@@ -240,7 +240,7 @@ function validate_args
|
|
|
b46d12 |
echo "--enable_foreign must be either 'y' or 'n'"
|
|
|
b46d12 |
exit 1
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
- if [ -z "$ENABLE" -a -z "$FIND" -a -z "$FRIENDLY" -a -z "$PROPERTY" ]; then
|
|
|
b46d12 |
+ if [ -z "$ENABLE" -a -z "$FIND" -a -z "$FRIENDLY" -a -z "$PROPERTY" -a -z "$FOREIGN" ]; then
|
|
|
b46d12 |
SHOW_STATUS=1
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
if [ -n "$MODULE" ] && [ "$MODULE" != "y" -a "$MODULE" != "n" ]; then
|
|
|
b46d12 |
@@ -315,36 +315,36 @@ if [ "$MULTIPATHD" = "y" ]; then
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
|
|
|
b46d12 |
if [ "$HAVE_BLACKLIST" = "1" ]; then
|
|
|
b46d12 |
- if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*devnode \"\.\?\*\"" ; then
|
|
|
b46d12 |
+ if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*devnode[[:space:]][[:space:]]*\"\.\?\*\"" ; then
|
|
|
b46d12 |
HAVE_DISABLE=1
|
|
|
b46d12 |
- elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*devnode \"\.\?\*\"" ; then
|
|
|
b46d12 |
+ elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*devnode[[:space:]][[:space:]]*\"\.\?\*\"" ; then
|
|
|
b46d12 |
HAVE_DISABLE=0
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
|
|
|
b46d12 |
if [ "$HAVE_BLACKLIST" = "1" ]; then
|
|
|
b46d12 |
- if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*wwid \"\.\?\*\"" ; then
|
|
|
b46d12 |
+ if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*wwid[[:space:]][[:space:]]*\"\.\?\*\"" ; then
|
|
|
b46d12 |
HAVE_WWID_DISABLE=1
|
|
|
b46d12 |
- elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"" ; then
|
|
|
b46d12 |
+ elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*wwid[[:space:]][[:space:]]*\"\.\?\*\"" ; then
|
|
|
b46d12 |
HAVE_WWID_DISABLE=0
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
|
|
|
b46d12 |
if [ "$HAVE_DEFAULTS" = "1" ]; then
|
|
|
b46d12 |
- HAVE_FIND=`sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | sed -n 's/^[[:blank:]]*find_multipaths[[:blank:]]*\([^[:blank:]]*\).*$/\1/p' | sed -n 1p`
|
|
|
b46d12 |
+ HAVE_FIND=`sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | sed -n 's/^[[:blank:]]*find_multipaths[[:blank:]][[:blank:]]*\([^[:blank:]]*\).*$/\1/p' | sed -n 1p`
|
|
|
b46d12 |
if [ "$HAVE_FIND" = "1" ]; then
|
|
|
b46d12 |
HAVE_FIND="yes"
|
|
|
b46d12 |
elif [ "$HAVE_FIND" = "0" ]; then
|
|
|
b46d12 |
HAVE_FIND="no"
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
- if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*\(yes\|1\)" ; then
|
|
|
b46d12 |
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]][[:space:]]*\(yes\|1\)" ; then
|
|
|
b46d12 |
HAVE_FRIENDLY=1
|
|
|
b46d12 |
- elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*\(no\|0\)" ; then
|
|
|
b46d12 |
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]][[:space:]]*\(no\|0\)" ; then
|
|
|
b46d12 |
HAVE_FRIENDLY=0
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*enable_foreign" ; then
|
|
|
b46d12 |
HAVE_FOREIGN=0
|
|
|
b46d12 |
- elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign[[:space:]]*\"\^\$\"" ; then
|
|
|
b46d12 |
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign[[:space:]][[:space:]]*\"\^\$\"" ; then
|
|
|
b46d12 |
HAVE_FOREIGN=1
|
|
|
b46d12 |
elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign" ; then
|
|
|
b46d12 |
HAVE_FOREIGN=2
|
|
|
b46d12 |
@@ -352,9 +352,9 @@ if [ "$HAVE_DEFAULTS" = "1" ]; then
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
|
|
|
b46d12 |
if [ "$HAVE_EXCEPTIONS" = "1" ]; then
|
|
|
b46d12 |
- if sed -n '/^blacklist_exceptions[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*property[[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"" ; then
|
|
|
b46d12 |
+ if sed -n '/^blacklist_exceptions[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*property[[:space:]][[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"" ; then
|
|
|
b46d12 |
HAVE_PROPERTY=1
|
|
|
b46d12 |
- elif sed -n '/^blacklist_exceptions[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*property[[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"" ; then
|
|
|
b46d12 |
+ elif sed -n '/^blacklist_exceptions[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*property[[:space:]][[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"" ; then
|
|
|
b46d12 |
HAVE_PROPERTY=0
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
@@ -427,14 +427,14 @@ fi
|
|
|
b46d12 |
|
|
|
b46d12 |
if [ "$ENABLE" = 2 ]; then
|
|
|
b46d12 |
if [ "$HAVE_DISABLE" = 1 ]; then
|
|
|
b46d12 |
- sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode \"\.\?\*\"/# devnode ".*"/' $TMPFILE
|
|
|
b46d12 |
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode[[:space:]][[:space:]]*\"\.\?\*\"/# devnode ".*"/' $TMPFILE
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
if [ -z "$HAVE_WWID_DISABLE" ]; then
|
|
|
b46d12 |
sed -i '/^blacklist[[:space:]]*{/ a\
|
|
|
b46d12 |
wwid ".*"
|
|
|
b46d12 |
' $TMPFILE
|
|
|
b46d12 |
elif [ "$HAVE_WWID_DISABLE" = 0 ]; then
|
|
|
b46d12 |
- sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"/ wwid ".*"/' $TMPFILE
|
|
|
b46d12 |
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*wwid[[:space:]][[:space:]]*\"\.\?\*\"/ wwid ".*"/' $TMPFILE
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
if [ "$HAVE_EXCEPTIONS" = 1 ]; then
|
|
|
b46d12 |
sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ {/^[[:space:]]*wwid/ d}' $TMPFILE
|
|
|
b46d12 |
@@ -448,7 +448,7 @@ _EOF_
|
|
|
b46d12 |
add_blacklist_exceptions
|
|
|
b46d12 |
elif [ "$ENABLE" = 1 ]; then
|
|
|
b46d12 |
if [ "$HAVE_DISABLE" = 1 ]; then
|
|
|
b46d12 |
- sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode \"\.\?\*\"/# devnode ".*"/' $TMPFILE
|
|
|
b46d12 |
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode[[:space:]][[:space:]]*\"\.\?\*\"/# devnode ".*"/' $TMPFILE
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
elif [ "$ENABLE" = 0 ]; then
|
|
|
b46d12 |
if [ -z "$HAVE_DISABLE" ]; then
|
|
|
b46d12 |
@@ -456,7 +456,7 @@ elif [ "$ENABLE" = 0 ]; then
|
|
|
b46d12 |
devnode ".*"
|
|
|
b46d12 |
' $TMPFILE
|
|
|
b46d12 |
elif [ "$HAVE_DISABLE" = 0 ]; then
|
|
|
b46d12 |
- sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*devnode \"\.\?\*\"/ devnode ".*"/' $TMPFILE
|
|
|
b46d12 |
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*devnode[[:space:]][[:space:]]*\"\.\?\*\"/ devnode ".*"/' $TMPFILE
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
|
|
|
b46d12 |
@@ -467,14 +467,14 @@ if [ -n "$FIND" ]; then
|
|
|
b46d12 |
' $TMPFILE
|
|
|
b46d12 |
CHANGED_CONFIG=1
|
|
|
b46d12 |
elif [ "$FIND" != "$HAVE_FIND" ]; then
|
|
|
b46d12 |
- sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:blank:]]*find_multipaths[[:blank:]]*[^[:blank:]]*/ find_multipaths '"$FIND"'/' $TMPFILE
|
|
|
b46d12 |
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:blank:]]*find_multipaths[[:blank:]][[:blank:]]*[^[:blank:]]*/ find_multipaths '"$FIND"'/' $TMPFILE
|
|
|
b46d12 |
CHANGED_CONFIG=1
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
|
|
|
b46d12 |
if [ "$FRIENDLY" = "n" ]; then
|
|
|
b46d12 |
if [ "$HAVE_FRIENDLY" = 1 ]; then
|
|
|
b46d12 |
- sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*\(yes\|1\)/ user_friendly_names no/' $TMPFILE
|
|
|
b46d12 |
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]][[:space:]]*\(yes\|1\)/ user_friendly_names no/' $TMPFILE
|
|
|
b46d12 |
CHANGED_CONFIG=1
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
elif [ "$FRIENDLY" = "y" ]; then
|
|
|
b46d12 |
@@ -484,14 +484,14 @@ elif [ "$FRIENDLY" = "y" ]; then
|
|
|
b46d12 |
' $TMPFILE
|
|
|
b46d12 |
CHANGED_CONFIG=1
|
|
|
b46d12 |
elif [ "$HAVE_FRIENDLY" = 0 ]; then
|
|
|
b46d12 |
- sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*\(no\|0\)/ user_friendly_names yes/' $TMPFILE
|
|
|
b46d12 |
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]][[:space:]]*\(no\|0\)/ user_friendly_names yes/' $TMPFILE
|
|
|
b46d12 |
CHANGED_CONFIG=1
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
|
|
|
b46d12 |
if [ "$PROPERTY" = "n" ]; then
|
|
|
b46d12 |
if [ "$HAVE_PROPERTY" = 1 ]; then
|
|
|
b46d12 |
- sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ s/^[[:space:]]*property[[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"/# property \"(SCSI_IDENT_|ID_WWN)\"/' $TMPFILE
|
|
|
b46d12 |
+ sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ s/^[[:space:]]*property[[:space:]][[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"/# property \"(SCSI_IDENT_|ID_WWN)\"/' $TMPFILE
|
|
|
b46d12 |
CHANGED_CONFIG=1
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
elif [ "$PROPERTY" = "y" ]; then
|
|
|
b46d12 |
@@ -501,7 +501,7 @@ elif [ "$PROPERTY" = "y" ]; then
|
|
|
b46d12 |
' $TMPFILE
|
|
|
b46d12 |
CHANGED_CONFIG=1
|
|
|
b46d12 |
elif [ "$HAVE_PROPERTY" = 0 ]; then
|
|
|
b46d12 |
- sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*property[[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"/ property \"(SCSI_IDENT_|ID_WWN)\"/' $TMPFILE
|
|
|
b46d12 |
+ sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*property[[:space:]][[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"/ property \"(SCSI_IDENT_|ID_WWN)\"/' $TMPFILE
|
|
|
b46d12 |
CHANGED_CONFIG=1
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
fi
|
|
|
b46d12 |
--
|
|
|
b46d12 |
2.30.2
|
|
|
b46d12 |
|