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

[WIP] Shell protocol refactor #6248

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

benjamindoron
Copy link
Contributor

Description

In this PR, we refactor the core shell functionality or environment into a library,
allowing it to be consumed by other apps.

The purpose is to allow tools written for the shell, in development
environments, to be easily modified to work in automated ways in production.

This patchset also allows us to reduce the coupling between the UI,
the user interaction, and the shell protocol (etc) internals, but for
the moment, this hasn't been done.

  • Breaking change?
    • Breaking change - Does this PR cause a break in build or boot behavior?
    • Examples: Does it add a new library class or move a module to a different repo.
  • Impacts security?
    • Security - Does this PR have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?
    • Tests - Does this PR include any explicit test code?
    • Examples: Unit tests or integration tests.

How This Was Tested

UefiPayload was built and booted into the shell.

Integration Instructions

If you're developing an out-of-tree platform, add library definitions for ShellProtocolInteractivityLib and ShellProtocolsLib when this is merged.

This patch prepares the ShellPkg for the changes that follow, where we
refactor the core shell functionality or environment into a library,
allowing it to be consumed by other apps.

The purpose is to allow tools written for the shell, in development
environments, to be easily modified to work in production.

This patchset also allows us to reduce the coupling between the UI,
the user interaction, and the shell protocol (etc) internals, but for
the moment, this hasn't been done.

Signed-off-by: Benjamin Doron <[email protected]>
…raction

This library contains all aspects that handle the user's interaction
with the shell app, from command history and display output, to
user-controlled settings like the page break.

The NULL instance is only to be used for automation, not with the shell.

This library is a dependency for the follow-ups, but due to the current
coupling, it can't be built on its own.

A fair portion of it is a copy and refactor of the shell app.

Signed-off-by: Benjamin Doron <[email protected]>
…shell'

This patch represents the primary patch of this series: By linking
against this library, a shell-like environment will be available to the
consuming app.

It's mainly a copy and refactor of the shell app.

Signed-off-by: Benjamin Doron <[email protected]>
@github-actions github-actions bot added the impact:breaking-change This change breaks existing APIs impacting build or boot. label Sep 27, 2024
@tianocore-assign-reviewers
Copy link

WARNING: Cannot add some reviewers: A user specified as a reviewer for this PR is not a collaborator of the repository. Please add them as a collaborator to the repository so they can be requested in the future.

Non-collaborators requested:

Attn Admins:


Admin Instructions:

  • Add the non-collaborators as collaborators to the appropriate team(s) listed in teams
  • If they are no longer needed as reviewers, remove them from Maintainers.txt

@benjamindoron
Copy link
Contributor Author

I still want to go back and review how the headers are separated between public and private. This is mostly out of WIP status, but do not merge yet.

//
ASSERT (TabCompleteList != NULL);
if (TabCurrent == NULL) {
TabCurrent = (EFI_SHELL_FILE_INFO *)GetFirstNode (&TabCompleteList->Link);

Check failure

Code scanning / CodeQL

Returned pointer not checked High

Value may be null; it should be checked before dereferencing.
if (TabCurrent == NULL) {
TabCurrent = (EFI_SHELL_FILE_INFO *)GetFirstNode (&TabCompleteList->Link);
} else {
TabCurrent = (EFI_SHELL_FILE_INFO *)GetNextNode (&TabCompleteList->Link, &TabCurrent->Link);

Check failure

Code scanning / CodeQL

Returned pointer not checked High

Value may be null; it should be checked before dereferencing.
//
Column = (StartColumn + TabUpdatePos) % TotalColumn;
Row -= (StartColumn + StringCurPos) / TotalColumn - (StartColumn + TabUpdatePos) / TotalColumn;
OutputLength = StrLen (TabCurrent->FileName);

Check failure

Code scanning / CodeQL

Returned pointer not checked High

Value may be null; it should be checked before dereferencing.
@benjamindoron benjamindoron changed the title Shell protocol refactor [WIP] Shell protocol refactor Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact:breaking-change This change breaks existing APIs impacting build or boot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant