nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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