4cf8c08
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
4ff1f12
From: Adam Williamson <awilliam@redhat.com>
4ff1f12
Date: Thu, 14 May 2020 17:52:53 -0700
4cf8c08
Subject: [PATCH] 10_linux.in: restore existence check in `get_sorted_bls`
4ff1f12
4ff1f12
This is necessary to handle `/boot/loader/entries` not existing
4ff1f12
at all (or possibly existing but being empty - not sure about
4ff1f12
that case). Without this check, this function gets pretty wacky
4ff1f12
and winds up returning the contents of the current working
4ff1f12
directory, which of course causes whatever called it to break.
4ff1f12
4ff1f12
Resolves: rhbz#1836020
4ff1f12
4ff1f12
Signed-off-by: Adam Williamson <awilliam@redhat.com>
4ff1f12
---
4ff1f12
 util/grub.d/10_linux.in | 3 +++
4ff1f12
 1 file changed, 3 insertions(+)
4ff1f12
4ff1f12
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
4cf8c08
index 80299ecaf00..519e2d9e616 100644
4ff1f12
--- a/util/grub.d/10_linux.in
4ff1f12
+++ b/util/grub.d/10_linux.in
4ff1f12
@@ -141,6 +141,9 @@ get_sorted_bls()
4ff1f12
     local IFS=$'\n'
4ff1f12
 
4ff1f12
     files=($(for bls in ${blsdir}/*.conf; do
4ff1f12
+        if ! [[ -e "${bls}" ]] ; then
4ff1f12
+            continue
4ff1f12
+        fi
4ff1f12
         bls="${bls%.conf}"
4ff1f12
         bls="${bls##*/}"
4ff1f12
         echo "${bls}"