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

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