Blame SOURCES/0004-boom.bootloader-do-not-allow-deletion-of-read-only-b.patch

f44195
From 31f95734f0d6f90f256754377207f5373ff9015c Mon Sep 17 00:00:00 2001
f44195
From: "Bryn M. Reeves" <bmr@redhat.com>
f44195
Date: Tue, 14 Jun 2022 07:54:29 -0400
f44195
Subject: [PATCH 4/5] boom.bootloader: do not allow deletion of read-only boot
f44195
 entries
f44195
f44195
Currently when attempting to delete an entry that has been marked
f44195
read-only boom generates a misleading error message:
f44195
f44195
  # boom delete 7fce1e5
f44195
  Entry does not exist: /boot/loader/entries/619c4d9f1efa4cf7bd76f149f12138a0-7fce1e5-5.14.0-108.el9.x86_64.conf
f44195
f44195
Boom should not attempt to delete entries that are marked read-only;
f44195
these are either system provided entries, or entries that have been
f44195
modified outside of boom's control. Reject attempts to delete these
f44195
with an error that indicates the reason they cannot be removed:
f44195
f44195
  # boom delete f6f8df5
f44195
  Cannot delete read-only boot entry: /boot/loader/entries/68f613d8774e41e792fad28212cfedae-4.18.0-348.el8.x86_64.conf
f44195
f44195
Resolves: #10
f44195
f44195
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
f44195
(cherry picked from commit 42f66737e1d7dec432cd7fc330f87304a585c308)
f44195
---
f44195
 boom/bootloader.py | 4 ++++
f44195
 1 file changed, 4 insertions(+)
f44195
f44195
diff --git a/boom/bootloader.py b/boom/bootloader.py
f44195
index bbf7fd5..a81ea84 100644
f44195
--- a/boom/bootloader.py
f44195
+++ b/boom/bootloader.py
f44195
@@ -2445,6 +2445,10 @@ class BootEntry(object):
f44195
             :raises: ``OsError`` if an error occurs removing the file or
f44195
                      ``ValueError`` if the entry does not exist.
f44195
         """
f44195
+        if self.read_only:
f44195
+            raise ValueError("Cannot delete read-only boot "
f44195
+                             "entry: %s" % self._last_path)
f44195
+
f44195
         if not path_exists(self._entry_path):
f44195
             raise ValueError("Entry does not exist: %s" % self._entry_path)
f44195
         try:
f44195
-- 
f44195
2.34.3
f44195