This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygwin.dll: bug with select on Windows console

On Jan  9 15:36, Corinna Vinschen wrote:
> On Jan  8 15:58, john hood wrote:
> > On 1/8/16 11:29 AM, Corinna Vinschen wrote:
> > > On Jan  7 13:18, John Hood wrote:
> > >> Sorry about forgetting the testcase (which was good, actually, that
> > >> version had a bug).  I've attached it here.  This takes a single
> > >> argument, the timeout value for select() in microseconds.  A value of
> > >> 1000000 is fine for testing this issue.  Type at it, or just bang on the
> > >> keyboard with random keystrokes, and it will report the results from
> > >> select() and the characters read.  On a Windows console, it should
> > >> report an error within a few seconds.  Moving the mouse cursor over the
> > >> Windows console window while typing seems to provoke the error as well. 
> > > 
> > > No chance.  I tried this for a good hour now with the unpatched Cygwin
> > > DLL on 32 bit W7 and 64 bit W10 in 32 and 64 bit in a Windows console,
> > > and I can't provoke this error.  It just works for me.
> > 
> > My apologies for sending you down a wrong path.  Try again with
> > "socket-t 1000", which only waits 1ms.  I don't know what I was thinking
> > when I said the 1s timeout works fine.
> This helped and I found the culprit.  There are, in fact, two ways to
> leave select with a timeout.  One of them only occurs in the border
> cases where a device behind a descriptor generates events which are
> not supposed to generate a select event.

I forgot to mention, this affects especially consoles (window events,
mouse events) and /dev/windows.

> If that happens, the select
> loop is supposed to loop again, but the code first checks if the timeout
> has been hit in the meantime and, if so, it breaks from the loop with a
> timeout, aka, a return value of 0.  However, in this single case, the
> code neglected to zero out the descriptor arrays, which then leads to
> the problem you encountered.
> I fixed the code and took the opportunity to clean it up a little using
> basically the (fixed) patch I proposed two days ago.
> I've just uploaded new developer snapshots to
> and a new test release 2.4.0-0.17 which contain this fix.  Please give any
> of them a try.
> Thanks,
> Corinna


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]