904d351
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
904d351
From: Javier Martinez Canillas <javierm@redhat.com>
904d351
Date: Thu, 5 Mar 2020 16:21:47 +0100
904d351
Subject: [PATCH] efi/http: Export {fw,http}_path variables to make them global
904d351
904d351
The fw_path environment variable is used by http_configure() function to
904d351
determine the HTTP path that should be used as prefix when using relative
904d351
HTTP paths. And this is stored in the http_path environment variable.
904d351
904d351
Later, that variable is looked up by grub_efihttp_open() to generate the
904d351
complete path to be used in the HTTP request.
904d351
904d351
But these variables are not exported, which means that are not global and
904d351
so are only found in the initial context.
904d351
904d351
This can cause commands like configfile that create a new context to fail
904d351
because the fw_path and http_path variables will not be found.
904d351
904d351
Resolves: rhbz#1616395
904d351
904d351
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
904d351
---
904d351
 grub-core/kern/main.c    | 1 +
904d351
 grub-core/net/efi/http.c | 1 +
904d351
 2 files changed, 2 insertions(+)
904d351
904d351
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
e622855
index 1c540fc8c2..b573be6650 100644
904d351
--- a/grub-core/kern/main.c
904d351
+++ b/grub-core/kern/main.c
46968b6
@@ -143,6 +143,7 @@ grub_set_prefix_and_root (void)
904d351
       if (fw_path)
904d351
 	{
904d351
 	  grub_env_set ("fw_path", fw_path);
904d351
+	  grub_env_export ("fw_path");
904d351
 	  grub_dprintf ("fw_path", "fw_path:\"%s\"\n", fw_path);
904d351
 	  grub_free (fw_path);
904d351
 	}
904d351
diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
e622855
index de351b2cd0..755b7a6d05 100644
904d351
--- a/grub-core/net/efi/http.c
904d351
+++ b/grub-core/net/efi/http.c
904d351
@@ -39,6 +39,7 @@ http_configure (struct grub_efi_net_device *dev, int prefer_ip6)
904d351
 	  http_path++;
904d351
 	  grub_env_unset ("http_path");
904d351
 	  grub_env_set ("http_path", http_path);
904d351
+	  grub_env_export ("http_path");
904d351
 	}
904d351
     }
904d351