Skip to content

Conversation

@Ayush1325
Copy link
Contributor

  • Tested using OVMF using QEMU.

@rustbot label +O-UEFI

@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 Jan 12, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 12, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 14, 2026

☔ The latest upstream changes (presumably #151107) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot
Copy link
Collaborator

rustbot commented Jan 15, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Ayush1325
Copy link
Contributor Author

cc @nicholasbishop

Copy link
Contributor

@nicholasbishop nicholasbishop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Only thought I have is that this is basically the same implementation as the Windows join_paths, so they could share code. But I don't see a good existing place to put that shared code, and it's not a large amount of duplicated code, so I don't feel strongly about avoiding the duplication.

View changes since this review

if v.contains(&(b'"' as u16)) {
return Err(JoinPathsError);
} else if v.contains(&PATHS_SEP) {
joined.push(b'"' as u16);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you point to documentation suggesting it's valid to quote elements of the PATH? I'm not seeing anything to that effect in the linked specification.

Copy link
Contributor Author

@Ayush1325 Ayush1325 Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested on OVMF just now and indeed, while file names can contain ;, the path variable does not seem to support those paths. Using " does not seem to do anything (although it does not cause any error either).

So I have made ; an invalid character.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 24, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 24, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@Ayush1325
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 25, 2026
joined.push(PATHS_SEP)
}
let v = path.encode_wide().collect::<Vec<u16>>();
if v.contains(&QUOTE) || v.contains(&PATHS_SEP) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a path containing " is invalid (why do you think it is?) -- it just means that the file path has that character in it? The reason we need to forbid PATHS_SEP is that there's no way to escape that, so including it actually includes two paths (likely non-existent ones, though that's not guaranteed).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a path containing " is invalid (why do you think it is?) -- it just means that the file path has that character in it? The reason we need to forbid PATHS_SEP is that there's no way to escape that, so including it actually includes two paths (likely non-existent ones, though that's not guaranteed).

Well, according to UEFI shell spec, file name has the following rules: one or more ASCII characters, excluding * ? < > \ / ” : ). So from the perspective of path variable (which is specific to UEFI shell), a path cannot have ".

With that said, the reason of course is different.

  • ; will give us an incorrect (i.e. something user might not have expected) path variable.
  • " will give us an invalid path.

So not sure if we need to throw error for " (and other invalid characters).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My sense is that it doesn't make sense to attempt to validate that the components are valid paths in join_paths, we should only validate that the paths are accurately joined (i.e., each path on input is present in the output or an error is returned).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I have removed the " check.

}

impl fmt::Display for JoinPathsError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"not supported on this platform yet".fmt(f)
"path segment contains `\"` or `;`".fmt(f)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is stale.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -518,8 +518,8 @@ pub struct JoinPathsError {
///
/// Returns an [`Err`] (containing an error message) if one of the input
/// [`Path`]s contains an invalid character for constructing the `PATH`
/// variable (a double quote on Windows or a colon on Unix), or if the system
/// does not have a `PATH`-like variable (e.g. UEFI or WASI).
/// variable (a double quote on Windows or a colon on Unix and UEFI), or if
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a semicolon on UEFI?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

- PATHS_SEP is defined as global const since I will implement
  split_paths in the future.
- Tested using OVMF using QEMU.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-UEFI UEFI 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