Skip to content

IO (Unix): fixes blocking forever on incomplete terminal responses - #2653

Open
ihsandeniz wants to merge 1 commit into
fastfetch-cli:devfrom
ihsandeniz:fix-term-resp-partial
Open

ihsandeniz wants to merge 1 commit into
fastfetch-cli:devfrom
ihsandeniz:fix-term-resp-partial

Conversation

@ihsandeniz

Copy link
Copy Markdown
Contributor

ffGetTerminalResponse() only polls before the first read(). When the terminal answers with an incomplete response (e.g. \e[4;800 for \e[14t), vsscanf matches fewer than nParams values and the loop calls read() again; with ICANON off and VMIN=1 that call never returns.

This waits with the same FF_IO_TERM_RESP_WAIT_MS timeout before every subsequent read() as well. Tested on Linux with a pty that reports zero pixel size and replies to \e[14t with a full, a split (two writes, 30 ms apart) and a truncated response: before the change the truncated case hangs, after it fastfetch exits normally; full and split responses are still parsed. ctest passes.

Possibly related to #2584 (v2.67.1's --gen-config TUI queried the terminal size on every frame; that query is skipped there since 537635c).

ffGetTerminalResponse() polls only before the first read(). If the terminal
sends a response that is cut short (e.g. `\e[4;800` without the rest), the
following read() in the loop blocks forever because the tty is in
non-canonical mode with VMIN=1.

Wait with the same timeout before every subsequent read() as well.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant