Blame SOURCES/0072-RH-mpathconf-correctly-handle-spaces-after-option-na.patch

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