Cygwin doesn't handle SIGWINCH properly in Windows Terminal

Takashi Yano takashi.yano@nifty.ne.jp
Mon Feb 15 00:05:43 GMT 2021


On Sun, 14 Feb 2021 12:44:32 -0800
L A Walsh wrote:
> On 2021/02/14 00:43, Takashi Yano via Cygwin wrote:
> > This is because cygwin console handles SIGWINCH when the input
> > messages is processed. If the process does not call either read()
> > or select(), SIGWINCH will not be sent. This is the long standing
> > problem of the implementation and hard to fix.
> >
> > ....
> >
> > This seems to be a bug of console code. I will submit a patch
> > for this issue.
> >   
> ---
> I'd be careful 'fixing' this, as it seems to work the same
> way on linux / bash.
> 
> I have this func setup on bash_profile & bashrc on
> both cygwin and linux:
> 
> # display new size of terminal when resized
> :                                                         
> showsize () {\
>   declare s=$(stty size); s="(${s// /x})"  ;\
>   printf "%s" "$s${s//?/$'\b'}"       ;\
> }; export -f showsize
> 
> trap showsize SIGWINCH
> -----

This has been working as expected without 'fix' because bash
calls select() rather than read() when it waits for user input.
The problem is in console read() and select() has been working.

Moreover, the problem is only in console read() while pty does
not have.

> Of note, on linux, I didn't have to reset LINES/COLUMNS,
> however, on cygwin, I note that I should.
> 
> Oh well -- hmmm....is that a bug?

What do you mean by "reset LINES/COLUMNS"? I am not sure what
is the behaviour diffrence in Linux and cygwin you mentioned.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


More information about the Cygwin mailing list