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