grub2/0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch
Javier Martinez Canillas b914a7e168
Fix bugs in the blscfg module and in the 10_linux script for ppc64le
blscfg: Lookup default_kernelopts variable as fallback for options
  Related: rhbz#1765297
10_linux.in: fix early exit due error when reading petitboot version
  Resolves: rhbz#1827397

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2020-04-30 15:55:52 +02:00

33 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Thu, 30 Apr 2020 15:45:31 +0200
Subject: [PATCH] 10_linux.in: fix early exit due error when reading petitboot
version
The script uses bash's read built-in command to get the petitboot version
version, but this command has a non-zero exit status if the EOF is found.
Since the /sys/firmware/devicetree/base/ibm,firmware-versions/petitboot
string ends with a NUL character, use the empty string as read delimiter
to prevent the command to read to the end-of-file and exit with an error.
Resolves: rhbz#1827397
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
util/grub.d/10_linux.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 847646bd8a8..09adfce80fd 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -194,7 +194,7 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then
petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot"
if test -e ${petitboot_path}; then
- read -a petitboot_version < ${petitboot_path}
+ read -r -d '' petitboot_version < ${petitboot_path}
petitboot_version="$(echo ${petitboot_version//v})"
major_version="$(echo ${petitboot_version} | cut -d . -f1)"
minor_version="$(echo ${petitboot_version} | cut -d . -f2)"