nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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