Patches: Allow DEBUG OpenShell to start with too many file systems under Mac EFI (#582)

Early Mac EFI returns EFI_INVALID_PARAMETER if storage for any single
NVRAM variable exceeds a certain size (leaves 2006 bytes for the value,
if the variable has a 4 character name). Since all of fsXX:\efi\tools\,
fsXX:\efi\boot\ and fsXX:\ are added to a CHAR16 shell `path` variable
for each file system found, the variable exceeds this limit when there
are greater than 25 file systems.

In the RELEASE shell this causes the `path` variable to get set to a
strange value. Unfortunately in the DEBUG shell it causes an ASSERT
and the shell does not start.

With this patch the DEBUG shell behaves like RELEASE shell: due to the
implementation of ShellProtocol SetEnv, when there is an error the
variable gets deleted and not recreated, thus the final path variable
only contains paths for file systems after the one which caused the
error. While this patch is not an ideal fix for the underlying problem,
it does simply recreate the longstanding behaviour of the RELEASE shell
on the same systems, and is preferable to the DEBUG shell being unusable.

Addresses https://github.com/acidanthera/bugtracker/issues/2005
This commit is contained in:
Mike Beaton 2025-09-22 12:25:04 +03:00 committed by GitHub
parent 219e6e2fe9
commit 849b04fdf4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 0 deletions

View File

@ -7,6 +7,7 @@ OpenCore Changelog
- Fixed vaulting failures when custom fonts are used, thx @al3xtjames
- Updated documentation for several Booter quirks
- Added `background-color` NVRAM variable to fix 10.9 boot screen
- Fixed debug build of OpenShell not starting on Mac EFI with > 25 file systems
#### v1.0.5
- Fixed incorrect print in PCI device info dumping in `SysReport`

View File

@ -0,0 +1,28 @@
From b80d468ab21a80fdc83ce9c419e2eaf9cef6b744 Mon Sep 17 00:00:00 2001
From: ocbuild <ocbuild@acidanthera.local>
Date: Sun, 14 Sep 2025 21:47:29 +0100
Subject: [PATCH] ShellPkg: Allow DEBUG shell to start with too many file
systems under Mac EFI
---
ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
index b0c77e4..f27b727 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
@@ -1359,8 +1359,8 @@ ShellCommandAddMapItemAndUpdatePath (
StrnCatGrow (&NewPath, &NewPathSize, Name, 0);
StrnCatGrow (&NewPath, &NewPathSize, L"\\", 0);
- Status = gEfiShellProtocol->SetEnv (L"path", NewPath, TRUE);
- ASSERT_EFI_ERROR (Status);
+ gEfiShellProtocol->SetEnv (L"path", NewPath, TRUE);
+
FreePool (NewPath);
}
--
2.45.2