dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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