From 2671eaf5999128a48aba348d5a6f559607bfa36f Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 21 Jan 2020 16:49:37 -0500 Subject: [PATCH] import powerpc-utils-1.3.6-5.el8 --- ...tils-Suppress-errors-reading-kern.v2.patch | 85 +++++++++++++++++++ ...b66e941720313af2c6b1afb32a74f3e360f4.patch | 64 ++++++++++++++ SPECS/powerpc-utils.spec | 12 ++- 3 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 SOURCES/0001-powerpc-utils-Suppress-errors-reading-kern.v2.patch create mode 100644 SOURCES/powerpc-utils-ea4db66e941720313af2c6b1afb32a74f3e360f4.patch diff --git a/SOURCES/0001-powerpc-utils-Suppress-errors-reading-kern.v2.patch b/SOURCES/0001-powerpc-utils-Suppress-errors-reading-kern.v2.patch new file mode 100644 index 0000000..f99cde6 --- /dev/null +++ b/SOURCES/0001-powerpc-utils-Suppress-errors-reading-kern.v2.patch @@ -0,0 +1,85 @@ +From 4fe0e76e1d02787b4cf60eafd2fb3667897becf4 Mon Sep 17 00:00:00 2001 +From: Michael Bringmann +Date: Tue, 23 Jul 2019 15:58:21 -0500 +Subject: [PATCH 1/1] powerpc-utils: Suppress errors reading kernel + files + +A problem was observed with the evaluation of the '${devspec}' +by the script 'ofpathname'. This patch provided improved +handling of errors within that script, and by some of the +follow-on uses of the tool by the 'bootlist' script. + +* Deal with error messages returned sometimes by evaluation + of ${devspec} in 'ofpathname'. +* Strip embedded nulls from values provided by kernel files, + especially, /proc/device-tree${devspec}/namespace/name, + in 'ofpathname'. +* Redirect more error messages to /dev/null + +Signed-off-by: Michael Bringmann +--- + scripts/bootlist | 8 ++++---- + scripts/ofpathname | 4 ++-- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/scripts/bootlist b/scripts/bootlist +index 65926d7..5ce20cf 100755 +--- a/scripts/bootlist ++++ b/scripts/bootlist +@@ -169,7 +169,7 @@ get_logical_device_name() + local devname=$1 + local logical_name + +- logical_name=`$OFPATHNAME -l $devname 2>/dev/null` ++ logical_name=`$OFPATHNAME -l $devname 2>/dev/null | tr -d '\000'` + if [[ $? -ne 0 ]]; then + echo "" + else +@@ -207,11 +207,11 @@ show_bootlist() + local devlist=$1 + local i + +- for i in `$NVRAM --print-config=${devlist} | sed 's/ /\n/g'`; do ++ for i in `$NVRAM --print-config=${devlist} 2> /dev/null | sed 's/ /\n/g'`; do + if [[ $TRANSLATE_NAMES = "yes" ]]; then + name=`get_logical_device_name $i` + if [[ -z $name ]]; then +- echo "Could not translate $i to logical device name" ++ echo "Could not translate $i to logical device name" 2>&1 + else + case $name in + eth*) parse_eth_info $name $i ;; +@@ -230,7 +230,7 @@ show_bootlist() + + . $PSERIES_PLATFORM + if [[ $platform != $PLATFORM_PSERIES_LPAR ]]; then +- echo "bootlist: is not supported on the $platform_name platform" ++ echo "bootlist: is not supported on the $platform_name platform" 2>&1 + exit 1 + fi + +diff --git a/scripts/ofpathname b/scripts/ofpathname +index c37c6bd..09c0209 100755 +--- a/scripts/ofpathname ++++ b/scripts/ofpathname +@@ -656,7 +656,7 @@ l2of_nvme() + + goto_dir $PWD "device/devspec" + +- devspec=`$CAT $PWD/device/devspec` ++ devspec=`$CAT $PWD/device/devspec | tr -d '\000'` + if [[ -n $devspec ]]; then + found=1 + break +@@ -681,7 +681,7 @@ l2of_nvme() + + # Device type is usually 'namespace'. + # Get it from device-tree just in case. +- devtype=`$CAT /proc/device-tree${devspec}/namespace/name` ++ devtype=`$CAT /proc/device-tree${devspec}/namespace/name | tr -d '\000'` 2> /dev/null + if [[ -z $devtype ]]; then + err $ERR_NO_OFPATH + fi +-- +1.8.3.1 + diff --git a/SOURCES/powerpc-utils-ea4db66e941720313af2c6b1afb32a74f3e360f4.patch b/SOURCES/powerpc-utils-ea4db66e941720313af2c6b1afb32a74f3e360f4.patch new file mode 100644 index 0000000..f43e8b2 --- /dev/null +++ b/SOURCES/powerpc-utils-ea4db66e941720313af2c6b1afb32a74f3e360f4.patch @@ -0,0 +1,64 @@ +commit ea4db66e941720313af2c6b1afb32a74f3e360f4 +Author: Michael Bringmann +Date: Tue Sep 10 14:31:42 2019 -0500 + + Safe bootlist update + + This patch is intended to prevent problems with identifying or parsing + the bootlist devices from propagating into the system NVRAM configuration. + A number of such problems have been observed when processing USB devices. + + * If 'bootlist' encounters an invalid OF_DEVPATH entry, it will print + an notice, but still continue on to write invalid data to nvram. + + Changed to abort the script before writing bad data to nvram. + + * When 'ofpathname' encounters an invalid 'devspec' file or invalid + value in a 'devspec' file, while trying to find the logical pathname + for a scsi device, it may continue to return the invalid 'devspec' + value to the caller/invoking script. + + Changed to abort with an error message instead of returning that + invalid value to a caller like 'bootlist'. + + Example: + # bootlist -m normal sdb + # bootlist -m normal -o + Could not translate (null)/scsi@0/sd@0,0 to logical device name + + Signed-off-by: Tyrel Datwyler + +diff --git a/scripts/bootlist b/scripts/bootlist +index 65926d7..acdaf89 100755 +--- a/scripts/bootlist ++++ b/scripts/bootlist +@@ -459,6 +459,7 @@ if [[ ${#LOGICAL_NAMES[*]} -ne 0 ]]; then + + if [[ -z ${OF_DEVPATH[$ctr]} ]]; then + echo "Device ${LOGICAL_NAMES[$ctr]} does not appear to be valid." >&2 ++ exit 1 + else + # See if this is an ethernet adapter. If so, the next entries + # may be parameters for the bootlist entry. +diff --git a/scripts/ofpathname b/scripts/ofpathname +index c37c6bd..dc452c4 100755 +--- a/scripts/ofpathname ++++ b/scripts/ofpathname +@@ -803,9 +803,16 @@ l2of_scsi() + # move up directories until we find one with devspec information + goto_dir $PWD "devspec" + +- OF_PATH=`$CAT $PWD/devspec` ++ if [[ -e $PWD/devspec ]]; then ++ OF_PATH=`$CAT $PWD/devspec` ++ else ++ err $ERR_NO_OFPATH ++ fi ++ + if [[ -z $OF_PATH ]]; then + err $ERR_NO_OFPATH ++ elif [[ ! -e /proc/device-tree/$OF_PATH ]]; then ++ err $ERR_NO_OFPATH + fi + + local vdev=${OF_PATH%/*} diff --git a/SPECS/powerpc-utils.spec b/SPECS/powerpc-utils.spec index 6d5ed92..7b99b46 100644 --- a/SPECS/powerpc-utils.spec +++ b/SPECS/powerpc-utils.spec @@ -1,6 +1,6 @@ Name: powerpc-utils Version: 1.3.6 -Release: 3%{?dist} +Release: 5%{?dist} Summary: Utilities for PowerPC platforms Group: System Environment/Base @@ -37,6 +37,8 @@ Patch9: powerpc-utils-8b7978b114e5df89218daa9b4b48cc0e918ba917.patch Patch10: powerpc-utils-1d4147370a148b3a2ebadcf02abd4a6c9a763e6d.patch # Improve handling of errors from subsidiary scripts Patch11: powerpc-utils-dd6da6b329bac2743d1c80b5556b494c923c11ad.patch +Patch12: 0001-powerpc-utils-Suppress-errors-reading-kern.v2.patch +Patch13: powerpc-utils-ea4db66e941720313af2c6b1afb32a74f3e360f4.patch %description Utilities for PowerPC platforms. @@ -78,6 +80,8 @@ Core utilities for PowerPC platforms. %patch9 -p1 %patch10 -p1 %patch11 -p1 +%patch12 -p1 +%patch13 -p1 %build export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" @@ -179,6 +183,12 @@ ln -s nvram.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/nvsetenv.8.gz %changelog +* Wed Dec 04 2019 Than Ngo - 1.3.6-5 +- Resolves: #1779257, Safe bootlist update + +* Wed Jul 24 2019 Than Ngo - 1.3.6-4 +- Resolves: #1719372 - wrong disk gets booted after installation + * Fri Jun 07 2019 Than Ngo - 1.3.6-3 - Resolves: #1718254, improve handling of errors from subsidiary scripts