nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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