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

Fix a cooked read deadlock #17905

Merged
merged 1 commit into from
Sep 24, 2024
Merged

Fix a cooked read deadlock #17905

merged 1 commit into from
Sep 24, 2024

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Sep 11, 2024

Because _layoutLine would never return column == columnLimit for
control character visualizers, we'd get a deadlock in _redisplay,
as it tries to fill the line until it's full, but never achieve it.

Closes #17893

Validation Steps Performed

  • Press Ctrl-A to insert "^A"
  • Press Home to get to the start of the prompt
  • Press and hold "A" until the line wraps
  • The line wraps and there's no deadlock ✅

@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-CookedRead The cmd.exe COOKED_READ handling Priority-2 A description (P2) Product-Conhost For issues in the Console codebase Product-Terminal The new Windows Terminal. labels Sep 11, 2024
if (col > columnLimit)
{
columns = columnLimit;
return dist;
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed this code because I moved the line-wrap check into _layoutLine. I felt like that it made it more robust and easier to understand.

@lhecker lhecker force-pushed the dev/lhecker/17893-cooked-deadlock branch from a10f66b to 03e953a Compare September 11, 2024 13:19
@DHowett DHowett merged commit 0ce654e into main Sep 24, 2024
20 checks passed
@DHowett DHowett deleted the dev/lhecker/17893-cooked-deadlock branch September 24, 2024 19:06
DHowett pushed a commit that referenced this pull request Sep 24, 2024
Because `_layoutLine` would never return `column == columnLimit` for
control character visualizers, we'd get a deadlock in `_redisplay`,
as it tries to fill the line until it's full, but never achieve it.

Closes #17893

## Validation Steps Performed
* Press Ctrl-A to insert "^A"
* Press Home to get to the start of the prompt
* Press and hold "A" until the line wraps
* The line wraps and there's no deadlock ✅

(cherry picked from commit 0ce654e)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTEJwI
Service-Version: 1.22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CookedRead The cmd.exe COOKED_READ handling Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Conhost For issues in the Console codebase Product-Terminal The new Windows Terminal.
Projects
Development

Successfully merging this pull request may close these issues.

Cooked read can hang when editing a line with control characters
3 participants