powerpc-utils/SOURCES/powerpc-utils-d512169a87cc146bcd3844f266abef903d8d3c54.patch
2022-04-10 22:22:08 +00:00

31 lines
1.3 KiB
Diff

commit d512169a87cc146bcd3844f266abef903d8d3c54
Author: Tyrel Datwyler <tyreld@linux.ibm.com>
Date: Sat Mar 5 15:34:06 2022 -0600
bootlist: fix invalid hex number message
In dm_to_part() when kpartx returns no partitions tmajor and tminor are
empty. As a result the $(printf %d:%d 0x$tmajor 0x$tminor) command
subsititution reports the following error:
/usr/sbin/bootlist: line 277: printf: 0x: invalid hex number
Fix this by redirecting stderr to /dev/null.
Suggested-by: Than Ngo <than@redhat.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
diff --git a/scripts/bootlist b/scripts/bootlist
index 6187d6f..b5cfbd9 100755
--- a/scripts/bootlist
+++ b/scripts/bootlist
@@ -277,7 +277,7 @@ dm_to_part()
tmajmin=$(printf "%d:%d" 0x$tmajor 0x$tminor)
if [[ "$tmajmin" = "$dmpmajmin" ]]; then
partstart=${kp##* }
- for part in `ls -1d /sys/block/$sddev/$sddev*`; do
+ for part in `ls -1d /sys/block/$sddev/$sddev* 2>/dev/null`; do
pstart=$(cat $part/start 2>/dev/null)
if [[ "$pstart" -eq "$partstart" ]] ; then
echo "${part##*/}"