delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/01/09/09:36:41

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=wkuQPWmqyyUod1JueTwT85CAyaoVLsCHXTpLYaz3hdIrVbh1jZ6Q3
bTSRfr7+UhEeTxKMH5maU4buluDPo/C0KIbjkQ1SmUVoXIHRptDZU4RbUiyeCcZk
m18OyMt9osBXZ2GybYXYOQjIk69E9C39SXxcGtmy3aKTED34ep1l+M=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=CNCyXltE7LB78P7LBZEL8Kkf3SU=; b=aLUCN7Df06S/XtLerk3G+qzL5Nn6
gL5/WZn4X3su8cXPikv4iMP56vd6nhw36N3MrpG9nKZbt231y1Lm6Zhz+eCT2ik1
YObdoBy8JRdOUgOe6W650HggNa0lUMzteW3dMR7zHSHZ9Joy50nfjqnqZY+Jm+ir
kaPl4WGI7qP1NWg=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-101.2 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,KHOP_DYNAMIC,RCVD_IN_BRBL_LASTEXT,RCVD_IN_PBL,RDNS_DYNAMIC,USER_IN_WHITELIST autolearn=no version=3.3.2 spammy=DOT, Maintainer, H*f:sk:569022F, H*MI:sk:569022F
X-HELO: calimero.vinschen.de
Date: Sat, 9 Jan 2016 15:36:20 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: cygwin.dll: bug with select on Windows console
Message-ID: <20160109143620.GB16303@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <5680953B DOT 8050200 AT glup DOT org> <20160107173034 DOT GE20447 AT calimero DOT vinschen DOT de> <568EABDC DOT 1050606 AT glup DOT org> <20160108162906 DOT GJ20447 AT calimero DOT vinschen DOT de> <569022FC DOT 7030004 AT glup DOT org>
MIME-Version: 1.0
In-Reply-To: <569022FC.7030004@glup.org>
User-Agent: Mutt/1.5.24 (2015-08-30)

--l76fUT7nc3MelDdI
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 t=
he
> >> 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=
.=20
> >=20
> > 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.
>=20
> 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.  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

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

--l76fUT7nc3MelDdI
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWkRrkAAoJEPU2Bp2uRE+gd5MP/34Wn/HsPCRuIfc6ANCRO8W/
YHd8KdQVIe2PvNpFCwabnVL0wI4MIu7kIst0jo9K4UQFIbaqeuj4NLSzdtIlhjr8
7BnLaex9uiwLr0ZKqvrkcvAN4AA2Rt7KD/Vljw+3w3Hrj9J4INKKa7MVPSP2veBQ
HeaSkRs6EcAhgK9pYIQgyIwMW+MeoYvD3qcfE3SBXVe48fYrfGdXE1XAaY/CsSn/
A5tv4+oMosj/TuNJ9GiX/kLT6lbAT9dQlR19rqkGwvXDFfeAvFMdcuF47hxVscjp
LyU5jktcLPjzhRaAJ3HzF1A5/7wopup4Pm3AVgFqMOBZphgacMCFux4gCYdqg8Pb
C/mN23HH02+03jmXBe3pGWSZtxFF8tF20kY19GSdOq5W+euNxiIMRds0eZT7XGhQ
QXoZHRnbogBfPcgeSkOelLdM4JOaZVdU2m+B2YF/TW4nLSj2JPvQPcO9xlOam29Y
rwJvnzcycKw2+ndDOGAPlifItYGolVxFSKHLpZa+9YOAiudeH6/8kAX73/JJoK/B
BDogC+H5S6zNtzDNQHqv2Z6fb+OoyRk2ktQBdaxJNvATbT1BXenunAqmQU7K96lR
XMIzeWko0tRGgRCPp4s7J153BKj3FPOPURgNqoUtTiapkXzVsTtJPcmB5VTTesum
VP72mTavjzjXFlwwWOsi
=hZ7k
-----END PGP SIGNATURE-----

--l76fUT7nc3MelDdI--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019