From 4ff1f12e40f13aeb869122c434352fdfdf8971a4 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 14 May 2020 18:02:26 -0700 Subject: [PATCH] 10_linux.in: restore existence check in `get_sorted_bls` --- ...ore-existence-check-in-get_sorted_bl.patch | 36 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +++- 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch diff --git a/0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch b/0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch new file mode 100644 index 0000000..10e823b --- /dev/null +++ b/0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch @@ -0,0 +1,36 @@ +From 0cff1b8b056f408c0dd9f8e5f8071ea9f6193c6e Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Thu, 14 May 2020 17:52:53 -0700 +Subject: [PATCH 215/215] 10_linux.in: restore existence check in + `get_sorted_bls` + +This is necessary to handle `/boot/loader/entries` not existing +at all (or possibly existing but being empty - not sure about +that case). Without this check, this function gets pretty wacky +and winds up returning the contents of the current working +directory, which of course causes whatever called it to break. + +Resolves: rhbz#1836020 + +Signed-off-by: Adam Williamson +--- + util/grub.d/10_linux.in | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 80299ecaf..519e2d9e6 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -141,6 +141,9 @@ get_sorted_bls() + local IFS=$'\n' + + files=($(for bls in ${blsdir}/*.conf; do ++ if ! [[ -e "${bls}" ]] ; then ++ continue ++ fi + bls="${bls%.conf}" + bls="${bls##*/}" + echo "${bls}" +-- +2.26.2 + diff --git a/grub.patches b/grub.patches index 1ba1e26..717ec73 100644 --- a/grub.patches +++ b/grub.patches @@ -212,3 +212,4 @@ Patch0211: 0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch Patch0212: 0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch Patch0213: 0213-envblk-Fix-buffer-overrun-when-attempting-to-shrink-.patch Patch0214: 0214-10_linux.in-Store-cmdline-in-BLS-snippets-instead-of.patch +Patch0215: 0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch diff --git a/grub2.spec b/grub2.spec index e7728f9..34c1f1f 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 17%{?dist} +Release: 18%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Thu May 14 2020 Adam Williamson - 2.04-18 +- 10_linux.in: restore existence check in `get_sorted_bls` + Resolves: rhbz#1836020 + * Wed May 13 2020 Javier Martinez Canillas - 2.04-17 - Store cmdline in BLS snippets instead of using a grubenv variable