delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/12/09/02:03:15

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:message-id:date:from:mime-version:to:subject
:content-type; q=dns; s=default; b=itbZKru2um2nPM4OpcNihucCZ3m6d
IGQRtJcIbl+RrUDVqs++PAOGj8fp3kWBijXv3KzimOWKbOTVGIiGf+6hLDgR1eFE
HyNmm70lMjL9dDOVYMJGMK9tqKA8EMlthPv+SS90KI9Y2P9tSYLDO/2znjkcDw8P
4wY8BOKW7EoZpk=
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:message-id:date:from:mime-version:to:subject
:content-type; s=default; bh=DA/975EThiPFLgU+blZgpglcD4g=; b=ASS
RGepuo5vnikAmApteiO0d9hTh6AVZkXEHTSKJ7aiF/K4Ol6UMoXRMrMsB7PykR38
rfkzMJ7w6xKJXRt1UmopC95I4cuUeKptedp1wwghHruA9akbx8ko+fo8RQSVTl9Z
ZHWyQQYWjLTHLlzu1vnd6DeqjMM+DaC5a7/n2M4k=
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=3.9 required=5.0 tests=AWL,BAYES_50,FOREIGN_BODY,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_WEB autolearn=no version=3.3.2
X-HELO: mout.kundenserver.de
Message-ID: <54869E93.60304@towo.net>
Date: Tue, 09 Dec 2014 08:02:43 +0100
From: Thomas Wolff <towo AT towo DOT net>
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.3.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: select() fails on multi-byte input in cygwin console (since 1.7.10)
X-UI-Out-Filterresults: notjunk:1;
X-IsSubscribed: yes

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

Calling select() to check whether input from the terminal is available
fails for all but the first byte in the cygwin console if multiple bytes
are entered at once, like function or cursor keys or non-ASCII UTF-8
characters.
Actually, the issue is volatile, sometimes it works for characters and
most function keys.
The problem most likely arises with the escape sequences mouse scroll
and window focus out/in (both enabled by the test program).
I tried to use read() with timeout instead, trying various combinations
of tcsetattr setting VMIN/VTIME, fcntl setting O_NONBLOCK, using read()
with buffer length 0, trying to interrupt read() with a timer signal, or
even a combination of setitimer() and siglongjmp().
None of this works.

Thanks to the cygwin time machine, I could track back this bug to have
appeared in 1.7.10 (around the time I had reported another select()
issue: https://sourceware.org/ml/cygwin/2011-05/msg00418.html which I
hope doesn=E2=80=99t interfere, nor the later issue
https://sourceware.org/ml/cygwin/2013-01/msg00139.html).

------
Thomas



---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren gepr=C3=BCft.
http://www.avast.com

--------------020002050603090401030901
Content-Type: text/plain; charset=windows-1252;
 name="test-select.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="test-select.c"

I2luY2x1ZGUgPHN0ZGxpYi5oPgojaW5jbHVkZSA8dW5pc3RkLmg+CiNpbmNs
dWRlIDxmY250bC5oPgojaW5jbHVkZSA8dGVybWlvcy5oPgojaW5jbHVkZSA8
c3RkaW8uaD4KCiNpbmNsdWRlIDxzeXMvc2VsZWN0Lmg+CiNpbmNsdWRlIDx0
aW1lLmg+CiNpb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XHJcbiIpOwogIHJldHVybiAwOwp9Cg==


--------------020002050603090401030901
Content-Type: text/plain; charset=us-ascii

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
--------------020002050603090401030901--

- Raw text -


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