-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Don't crash trying to parse a command line that's a directory #12538
Don't crash trying to parse a command line that's a directory #12538
Conversation
@check-spelling-bot ReportUnrecognized words, please review:
Previously acknowledged words that are now absentazurewebsites cxcy debolden deconstructed devicefamily guardxfg LLVM MSDL ned NOWAIT pgorepro pgort PGU Timeline timelines unintense WResult xfgTo accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands... in a clone of the git@github.com:ianjoneill/terminal.git repository
✏️ Contributor please read thisBy default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
If the listed items are:
See the 🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉 🗜️ If you see a bunch of garbageIf it relates to a ... well-formed patternSee if there's a pattern that would match it. If not, try writing one and adding it to a Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines. Note that patterns can't match multiline strings. binary-ish stringPlease add a file path to the File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for hopping on this so fast!
@msftbot make sure @lhecker approves |
Hello @zadjii-msft! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this!
Hello @lhecker! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
## Summary of the Pull Request Prevents a crash that could occur when invoking `wt C:\` ## PR Checklist * [x] Closes #12535 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] Tests added/passed * [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx * [ ] Schema updated. * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx ## Detailed Description of the Pull Request / Additional comments Updates `CascadiaSettings::NormalizeCommandLine()` to check that there are a suitable number of command line arguments to be concatenated together, to prevent accessing an array index in `argv` that doesn't exist. Also prevents a test flake that could occur in `TerminalSettingsTests::CommandLineToArgvW()`, due to generating an empty command line argument. ## Validation Steps Performed Added a test, and checked that invoking each of the command lines below behaved as expected: ``` wtd C:\ # Window pops up with [error 2147942405 (0x80070005) when launching `C:\'] wtd C:\Program Files # Window pops up with [error 2147942402 (0x80070002) when launching `C:\Program Files'] wtd cmd # cmd profile pops up wtd C:\Program Files\Powershell\7\pwsh -WorkingDirectory C:\ # PowerShell profile pops up in C:\ wtd "C:\Program Files\Powershell\7\pwsh" -WorkingDirectory C:\ # PowerShell profile pops up in C:\ wtd . # Window pops up with [error 2147942405 (0x80070005) when launching `.'] ```
## Summary of the Pull Request Prevents a crash that could occur when invoking `wt C:\` ## PR Checklist * [x] Closes #12535 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] Tests added/passed * [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx * [ ] Schema updated. * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx ## Detailed Description of the Pull Request / Additional comments Updates `CascadiaSettings::NormalizeCommandLine()` to check that there are a suitable number of command line arguments to be concatenated together, to prevent accessing an array index in `argv` that doesn't exist. Also prevents a test flake that could occur in `TerminalSettingsTests::CommandLineToArgvW()`, due to generating an empty command line argument. ## Validation Steps Performed Added a test, and checked that invoking each of the command lines below behaved as expected: ``` wtd C:\ # Window pops up with [error 2147942405 (0x80070005) when launching `C:\'] wtd C:\Program Files # Window pops up with [error 2147942402 (0x80070002) when launching `C:\Program Files'] wtd cmd # cmd profile pops up wtd C:\Program Files\Powershell\7\pwsh -WorkingDirectory C:\ # PowerShell profile pops up in C:\ wtd "C:\Program Files\Powershell\7\pwsh" -WorkingDirectory C:\ # PowerShell profile pops up in C:\ wtd . # Window pops up with [error 2147942405 (0x80070005) when launching `.'] ``` (cherry picked from commit 722aafa)
🎉 Handy links: |
🎉 Handy links: |
Summary of the Pull Request
Prevents a crash that could occur when invoking
wt C:\
PR Checklist
wt .
#12535Detailed Description of the Pull Request / Additional comments
Updates
CascadiaSettings::NormalizeCommandLine()
to check that there are a suitable number of command line arguments to be concatenated together, to prevent accessing an array index inargv
that doesn't exist.Also prevents a test flake that could occur in
TerminalSettingsTests::CommandLineToArgvW()
, due to generating an empty command line argument.Validation Steps Performed
Added a test, and checked that invoking each of the command lines below behaved as expected: