Repository navigation
IO (Unix): fixes blocking forever on incomplete terminal responses - #2653
Open
ihsandeniz wants to merge 1 commit into
Open
ihsandeniz wants to merge 1 commit into
ihsandeniz wants to merge 1 commit into
Conversation
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.
3 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ffGetTerminalResponse()only polls before the firstread(). When the terminal answers with an incomplete response (e.g.\e[4;800for\e[14t),vsscanfmatches fewer thannParamsvalues and the loop callsread()again; withICANONoff andVMIN=1that call never returns.This waits with the same
FF_IO_TERM_RESP_WAIT_MStimeout before every subsequentread()as well. Tested on Linux with a pty that reports zero pixel size and replies to\e[14twith 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.ctestpasses.Possibly related to #2584 (v2.67.1's
--gen-configTUI queried the terminal size on every frame; that query is skipped there since 537635c).