public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: cygwin@cygwin.com
Subject: Re: [ANNOUNCEMENT] Updated: libreadline7-7.0.1-1, libreadline-devel-7.0.1-1, bash-4.4.5-1
Date: Thu, 19 Jan 2017 14:21:00 -0000	[thread overview]
Message-ID: <9b15fb8f-7925-a963-0947-51dfe68d4058@redhat.com> (raw)
In-Reply-To: <102fbd64-1bc2-41ee-63d2-932a81124b75@cs.umass.edu>


[-- Attachment #1.1: Type: text/plain, Size: 2423 bytes --]

On 01/19/2017 07:23 AM, Eliot Moss wrote:
>> I have root caused this. With the new readline, running ./configure
> creates
>> config.h, as expected. However new version adds this line:
>>
>> #define HAVE_PSELECT 1
>>
>> If you remove this from config.h, then make, the resultant DLL behaves
> as it did
>> with previous readline. Not sure what is causing this change, I will
> try to dig
>> into it more.
> 
> You probably found it, but here's why they added use of pselect:
> 
> "h.  Use pselect(2), if available, to wait for input before calling
> read(2), so
>     a SIGWINCH can interrupt it, since it doesn't interrupt read(2)."
> 
> Of course that does not explain why it's not working how we would like ...

Here's my guess - cygwin1.dll has an incomplete implementation of
pselect on Windows consoles when it comes to capturing ALT-numkeypad
sequences.  Probably something to do with the fact that it takes
multiple keystrokes before a single character is supposed to be
recognized, which means you have to make a decision after each key state
change event whether a character is complete or not.  Under the old
code, when pselect was not in use, readline just used read() until a
character showed up (but blocked in doing so, and risked SIGWINCH
issues); now readline can use pselect() and sees that a key has been
pressed, except that there is no input available until several more keys
are pressed and a key released.

I'm no expert in the windows console handling code in cygwin1.dll, but
if you are correct that the use (or absence) of HAVE_PSELECT in modern
readline makes a difference, then it sounds like we have two things to
do: first, I will rebuild readline with a patch to avoid pselect() (the
behavior of readline will be riskier, and may break under SIGWINCH, but
at least that is no worse than it was with the old readline), meanwhile,
someone with more expertise in the console handling code will need a
boiled-down testcase (probably a simple .c program that compares a
straight read() with a pselect() loop that decides when to read()) to
see if they can fix the handling of ALT-numkeypad entries under the
console in cygwin1.dll.  Once a fixed cygwin1.dll is available, then I
can re-release a version of readline built with HAVE_PSELECT.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2017-01-19 14:21 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-03 16:55 Eric Blake (cygwin)
2017-01-13  5:07 ` Steven Penny
2017-01-13 14:47   ` Eric Blake
2017-01-14  0:23     ` Steven Penny
2017-01-14 21:48       ` Eric Blake
2017-01-15  0:27         ` Steven Penny
2017-01-15 13:23           ` Vince Rice
2017-01-15 14:11             ` cyg Simple
2017-01-15 14:30               ` Steven Penny
2017-01-16 10:32                 ` Yaakov Selkowitz
2017-01-16 12:40                   ` Steven Penny
2017-01-15 22:33         ` Thomas Wolff
2017-01-16  0:45           ` Steven Penny
2017-01-16  0:54             ` Steven Penny
2017-01-17  2:47         ` Steven Penny
2017-01-17  3:32           ` Steven Penny
2017-01-18  0:36             ` Steven Penny
2017-01-18  2:08               ` Eric Blake
2017-01-18  3:55                 ` Steven Penny
2017-01-18  4:09                   ` Doug Henderson
2017-01-18  5:02                     ` Larry Hall (Cygwin)
2017-01-18  5:45                       ` Steven Penny
2017-01-19  5:23                         ` Steven Penny
2017-01-19 13:23                           ` Eliot Moss
2017-01-19 14:21                             ` Eric Blake [this message]
2017-01-19 18:13                               ` Corinna Vinschen
2017-01-19 23:54                                 ` Steven Penny
2017-01-20 13:04                                   ` Corinna Vinschen
2017-01-20 14:51                           ` Eric Blake
2017-01-20 15:00                             ` Eric Blake
2017-01-21  3:57                               ` Steven Penny
2017-01-18  1:46     ` Eric Blake

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=9b15fb8f-7925-a963-0947-51dfe68d4058@redhat.com \
    --to=eblake@redhat.com \
    --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).