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

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