Skip to content

an escape sequence broken across multiple read()'s is not handled quite right #2852

@tstack

Description

@tstack

I think the last change for #2647 is causing problems when I'm testing with WSL/Windows Terminal.

I'm working with Windows 11 24H2 and installed Ubuntu 24.04 WSL. Using Windows Terminal, I start a shell in ubuntu and run my program. Sometimes it works and other times it stalls out. Tracing things through, the DA1 response is getting split across two read() calls. The first call returns 16 bytes with \e[?61;6;7;14;21;. Since the c terminator did not come through, process_escape() returns with -16 and midescape set to 1. But, then process_melange() hits the || *bufused == origlencondition and clears themidescape` and the bytes there are treated as regular input. Since the DA1 response never comes through, initialization stalls out.

The relevant change:

c888217#diff-b7dbcafb0f8345e04cd585f962cdc2d12c9e79b68e13fe6099aeece3b785ce2bL2300-R2301

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions