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

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