[PATCH] Cygwin: console: Fix segfault on shared_console_info access.

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Feb 24 18:33:00 GMT 2020


On Feb 25 01:10, Takashi Yano wrote:
> On Mon, 24 Feb 2020 11:08:35 +0100
> Corinna Vinschen wrote:
> [...]
> > Btw., are you testing the console with black background?  I'm asking
> > because I'm using the console with grey background and black characters,
> > and I'm always seeing artifacts when using vim in xterm mode.
> > 
> > E.g., open vim on the fork-setsid.c source in the console in xterm
> > mode.  Move the cursor to the beginning of the word `setsid'.  Now
> > press the three chars
> > 
> >   c h <CR>
> > 
> > this moves the setsid call to the next line.  But it also adds
> > black background after `setsid();'.  Simiar further actions always
> > create black background artifacts.
> > 
> > Is there anything we can do against that?
> 
> This seems to be a bug of windows console. It also occurs in wsl.
> /bin/echo -e '\033[H\033[5L'
> causes the similar result.

Oh well.

> The following code cause the problem as well.
> 
> #include <windows.h>
> int main()
> {
>     CONSOLE_SCREEN_BUFFER_INFO sbi;
>     SMALL_RECT r;
>     COORD c = {0, 0};
>     CHAR_INFO f = {' ', 0};
>     HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
>     DWORD n;
>     ReadConsoleOutputAttribute(h, &f.Attributes, 1, c, &n);
>     GetConsoleScreenBufferInfo(h, &sbi);
>     c.X = 0;
>     c.Y = sbi.srWindow.Top + 5;
>     ScrollConsoleScreenBuffer(h, &sbi.srWindow, NULL, c, &f);
>     return 0;
> }

Is there some kind of workaround for that problem?  Otherwise defaulting
to a (broken) xterm mode instead of a (working) cygwin mode is a bit
questionable, isn't it?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20200224/7a1b2819/attachment.sig>


More information about the Cygwin-patches mailing list