Blame SOURCES/0271-efi-http-Export-fw-http-_path-variables-to-make-them.patch

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