Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of ShellOpt variable during initialization shouldn't imply null termination (Bugzilla Bug 4872) #10549

Open
tianocore-issues opened this issue Nov 11, 2024 · 1 comment
Labels
package:shellpkg priority:low Little to no impact. No urgency to fix. type:bug Something isn't working

Comments

@tianocore-issues
Copy link

This issue was created automatically with bugzilla2github

Bugzilla Bug 4872

Date: 2024-11-11T18:40:59+00:00
From: Roman Valov <<roman.valov>>
To: unassigned <>
CC:

Last updated: 2024-11-11T18:40:59+00:00

@tianocore-issues
Copy link
Author

Comment 23527

Date: 2024-11-11 18:40:59 +0000
From: Roman Valov <<roman.valov>>

  • Industry Specification: ---
  • Release Observed: EDK II Master
  • Releases to Fix: EDK II Master
  • Target OS: ---
  • Bugzilla Assignee(s): unassigned <>

Hi there

I'm playing around with UEFI shell configuration via ShellOpt variable. For example I can configure value of ShellOpt using one of following ways:

In Linux:

$ echo -ne "-nomap -delay 11" | iconv -t ucs2 > ./var.bin
$ sudo efivar -w --name=158DEF5A-F656-419C-B027-7A3192C079D2-ShellOpt --datafile=./var.bin

In UEFI Shell:

> setvar ShellOpt -guid 158DEF5A-F656-419C-B027-7A3192C079D2 =L"-nomap -delay 11"

But when I reboot the machine and UEFI attempts to initialize I've got an error like:

11@ is not recognized as an internal or external command, operable program, or script file.

To me it seems that UEFI catches some data that follows variable text in memory. I could workaround it by adding null character to variable text like:

In Linux:

$ echo -ne "-nomap -delay 11\0" | iconv -t ucs2 > ./var.bin
$ sudo efivar -w --name=158DEF5A-F656-419C-B027-7A3192C079D2-ShellOpt --datafile=./var.bin

In UEFI Shell:

> setvar ShellOpt -guid 158DEF5A-F656-419C-B027-7A3192C079D2 =L"-nomap -delay 11" =0000

and now ShellOpt works.

Things go weird given that I can configure ShellOpt variable using shell's set command used to manage shell environment variables:

> set ShellOpt " -nomap -delay 11"

and I've got the same error as described before on following shell initialization.

Given that all the tools in Linux and in UEFI Shell display correct values when I attempt to inspect the varialbe, it looks like ShellOpt processing code expects null terminator to be a part of the variable but it should not. Please fix.

P.S.: I don't know how to escape - sign in the front of variable value when using set command, so I have to prepend the value with a space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:shellpkg priority:low Little to no impact. No urgency to fix. type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant