dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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