Skip to content

std: Don't panic when removing a nonexistent UEFI var#152357

Open
nicholasbishop wants to merge 1 commit intorust-lang:mainfrom
nicholasbishop:push-uolpvnvrlznw
Open

std: Don't panic when removing a nonexistent UEFI var#152357
nicholasbishop wants to merge 1 commit intorust-lang:mainfrom
nicholasbishop:push-uolpvnvrlznw

Conversation

@nicholasbishop
Copy link
Contributor

std::env::remove_var does not say that deleting a nonexistent variable is an error (and at least on Linux, it indeed does not cause an error).

The UEFI Shell Protocol spec also doesn't say it's an error, but the edk2 implementation delegates to the UEFI runtime SetVariable function, which returns EFI_NOT_FOUND when trying to delete a nonexistent variable.

Change the UEFI implementation to check for a NotFound error and treat it as success.

CC @Ayush1325

`std::env::remove_var` does not say that deleting a nonexistent variable
is an error (and at least on Linux, it indeed does not cause an
error).

The UEFI Shell Protocol spec also doesn't say it's an error, but the
edk2 implementation delegates to the UEFI runtime `SetVariable`
function, which returns `EFI_NOT_FOUND` when trying to delete a
nonexistent variable.

Change the UEFI implementation to check for a `NotFound` error and treat
it as success.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 8, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 8, 2026

r? @ChrisDenton

rustbot has assigned @ChrisDenton.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 8 candidates
  • Random selection from ChrisDenton, Mark-Simulacrum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants