nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0129-Export-all-variables-from-the-initial-context-when-c.patch

8e15ce
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8e15ce
From: Javier Martinez Canillas <javierm@redhat.com>
8e15ce
Date: Tue, 22 Jan 2019 15:40:25 +0100
8e15ce
Subject: [PATCH] Export all variables from the initial context when creating a
8e15ce
 submenu
8e15ce
8e15ce
When a submenu is created, only the exported variables are copied to the
8e15ce
new menu context. But we want the variables to be global, so export lets
8e15ce
export all variables to the new created submenu.
8e15ce
8e15ce
Also, don't unset the default variable when a new submenu is created.
8e15ce
8e15ce
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
8e15ce
---
8e15ce
 grub-core/normal/context.c | 2 +-
8e15ce
 grub-core/normal/menu.c    | 2 --
8e15ce
 2 files changed, 1 insertion(+), 3 deletions(-)
8e15ce
8e15ce
diff --git a/grub-core/normal/context.c b/grub-core/normal/context.c
8e15ce
index ee53d4a68e5..87edd254c44 100644
8e15ce
--- a/grub-core/normal/context.c
8e15ce
+++ b/grub-core/normal/context.c
8e15ce
@@ -99,7 +99,7 @@ grub_env_new_context (int export_all)
8e15ce
 grub_err_t
8e15ce
 grub_env_context_open (void)
8e15ce
 {
8e15ce
-  return grub_env_new_context (0);
8e15ce
+  return grub_env_new_context (1);
8e15ce
 }
8e15ce
 
8e15ce
 int grub_extractor_level = 0;
8e15ce
diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
8e15ce
index ea714d27176..d4832f17699 100644
8e15ce
--- a/grub-core/normal/menu.c
8e15ce
+++ b/grub-core/normal/menu.c
8e15ce
@@ -375,8 +375,6 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot)
8e15ce
 
8e15ce
   if (ptr && ptr[0] && ptr[1])
8e15ce
     grub_env_set ("default", ptr + 1);
8e15ce
-  else
8e15ce
-    grub_env_unset ("default");
8e15ce
 
8e15ce
   grub_script_execute_new_scope (entry->sourcecode, entry->argc, entry->args);
8e15ce