dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0238-blscfg-don-t-include-.conf-at-the-end-of-our-id.patch

8631a2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8631a2
From: Peter Jones <pjones@redhat.com>
8631a2
Date: Thu, 11 Oct 2018 15:30:13 -0400
8631a2
Subject: [PATCH] blscfg: don't include ".conf" at the end of our "id".
8631a2
8631a2
Related: rhbz#1638117
8631a2
8631a2
Signed-off-by: Peter Jones <pjones@redhat.com>
8631a2
---
8631a2
 grub-core/commands/blscfg.c | 11 +++++++++++
8631a2
 1 file changed, 11 insertions(+)
8631a2
8631a2
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
8631a2
index bec5a9ffe3e..3847572dabd 100644
8631a2
--- a/grub-core/commands/blscfg.c
8631a2
+++ b/grub-core/commands/blscfg.c
8631a2
@@ -575,6 +575,7 @@ static void create_entry (struct bls_entry *entry)
8631a2
   char **initrds = NULL;
8631a2
   char *initrd = NULL;
8631a2
   char *id = entry->filename;
8631a2
+  char *dotconf = id;
8631a2
   char *hotkey = NULL;
8631a2
 
8631a2
   char *users = NULL;
8631a2
@@ -593,6 +594,16 @@ static void create_entry (struct bls_entry *entry)
8631a2
       goto finish;
8631a2
     }
8631a2
 
8631a2
+  /*
8631a2
+   * strip the ".conf" off the end before we make it our "id" field.
8631a2
+   */
8631a2
+  do
8631a2
+    {
8631a2
+      dotconf = grub_strstr(dotconf, ".conf");
8631a2
+    } while (dotconf != NULL && dotconf[5] != '\0');
8631a2
+  if (dotconf)
8631a2
+    dotconf[0] = '\0';
8631a2
+
8631a2
   title = bls_get_val (entry, "title", NULL);
8631a2
   options = expand_val (bls_get_val (entry, "options", NULL));
8631a2
   initrds = bls_make_list (entry, "initrd", NULL);