public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Cc: John Hood <cgull@glup.org>
Subject: Re: cygwin.dll: bug with select on Windows console
Date: Sat, 09 Jan 2016 14:42:00 -0000	[thread overview]
Message-ID: <20160109144131.GD16303@calimero.vinschen.de> (raw)
In-Reply-To: <20160109143620.GB16303@calimero.vinschen.de>

[-- Attachment #1: Type: text/plain, Size: 2451 bytes --]

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 https://cygwin.com/snapshots/
> and a new test release 2.4.0-0.17 which contain this fix.  Please give any
> of them a try.
> 
> 
> Thanks,
> Corinna


Corinna

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-01-09 14:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-28  1:50 john hood
2016-01-02  2:06 ` John Hood
2016-01-03  0:45   ` Mark Geisert
2016-01-07  0:48 ` Mark Geisert
2016-01-07 17:30 ` Corinna Vinschen
2016-01-07 18:18   ` John Hood
2016-01-07 18:55     ` John Hood
2016-01-08 16:31     ` Corinna Vinschen
2016-01-08 21:30       ` john hood
2016-01-08 22:21         ` Achim Gratz
2016-01-09 14:41         ` Corinna Vinschen
2016-01-09 14:42           ` Corinna Vinschen [this message]
2016-01-10  9:09             ` John Hood
2016-01-11 11:52               ` Corinna Vinschen
2016-01-12 17:32                 ` john hood
2016-01-12 22:09                   ` Corinna Vinschen
2016-01-14 15:22           ` cygwin.dll: bug with select on Windows console / 2.4.0-0.19 Thomas Wolff
2016-01-14 20:24             ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160109144131.GD16303@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cgull@glup.org \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).