Skip to content

library: std: sys: args: uefi: Fix issue-16272 - #165763

Open
Ayush1325 wants to merge 1 commit into
rust-lang:mainfrom
Ayush1325:uefi-tests
Open

Ayush1325 wants to merge 1 commit into
rust-lang:mainfrom
Ayush1325:uefi-tests

Conversation

@Ayush1325

@Ayush1325 Ayush1325 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

- Fix failing test tests/ui/process/issue-16272.rs for UEFI.
- Basically, if the last quoted arg was empty, it was ignored in the
  current implementation. This behaviour is incorrect and was already
  fixed on windows in the past. Do the same for UEFI.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 10, 2026
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Nov 10, 2026
@rustbot

rustbot commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

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

Why was this reviewer chosen?

The reviewer was selected based on:

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

Comment on lines +107 to +115
QUOTE if in_quotes => match code_units_iter.peek() {
// The end of the command line.
// Push `cur` even if empty, which we do by breaking while `in_quotes` is still set.
None | Some(Ok(NULL)) => break,
// Close `in_quotes`.
Some(_) => in_quotes = false,
},
// If not `in_quotes` and not escaped (see above) then a quote sets `in_quote`.
QUOTE => in_quotes = true,

@maxdexh maxdexh Nov 11, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I find this much less clear than just a regular if-else.
Your "see above" comment kinda indicates you do too ^^

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Example rewrite:

Suggested change
QUOTE if in_quotes => match code_units_iter.peek() {
// The end of the command line.
// Push `cur` even if empty, which we do by breaking while `in_quotes` is still set.
None | Some(Ok(NULL)) => break,
// Close `in_quotes`.
Some(_) => in_quotes = false,
},
// If not `in_quotes` and not escaped (see above) then a quote sets `in_quote`.
QUOTE => in_quotes = true,
QUOTE => {
if in_quotes && matches!(code_units_iter.peek(), None | Some(Ok(NULL))) {
// Push `cur` even if empty, which we do by breaking while `in_quotes` is still set.
// This is to avoid empty quotes being ignored as the last argument.
break;
}
in_quotes = !in_quotes;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well, the current code was to preserve it's windows impl shape:

QUOTE if in_quotes => match code_units.peek() {

This whole function was deliberately written to mirror it's windows counterpart as closely as possible since other than some slight differences, most of the logic is the same (and so are the comments).

With that said, I personally don't have any objection to above change. The readability seems the same to me.

@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 Nov 11, 2026
@rustbot

rustbot commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

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

This branch has not been deployed

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

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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