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

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